900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > Eclipse使用Maven插件创建Web项目时出错:Could not resolve archetype org.apache.maven.archetypes

Eclipse使用Maven插件创建Web项目时出错:Could not resolve archetype org.apache.maven.archetypes

时间:2018-11-16 00:17:05

相关推荐

Eclipse使用Maven插件创建Web项目时出错:Could not resolve archetype org.apache.maven.archetypes

问题描述:

在Eclipse下,使用Maven插件创建Web项目时出错,错误提示如下:

错误信息:

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 from any of the configured repositories.

Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0

Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from https://repo./maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to central (https://repo./maven2): Remote host closed connection during handshake

Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from https://repo./maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to central (https://repo./maven2): Remote host closed connection during handshake

解决方案:

在Eclipse中打开“Preferences”--偏好设置窗口,在左侧列表中找到“Maven”的配置项,在展开列表之后选择“Archetypes”;

点击右侧的“Add Remote Catalog”按钮,在弹出的窗口中,在“Catalog File”输入框中输入:

/maven2/archetype-catalog.xml

在“Description”输入框中输入“maven remote catalog”(名字个人随意),点击“OK”按钮完成新增;继续点击“OK”按钮保存Maven设置。

在设置完毕之后,重新新建Maven项目,在弹出的窗口中,在“Catalog:”下拉框中选择刚才新建的“maven remote catalog”,然后找到“Group Id”为“org.apache.maven.archetypes”,“Artifact Id”为“maven-archetype-webapp”的选项(在这里列表选项过多,可以在“Filter”输入框中输入相应的信息进行查找),点击“Next”按钮:

输入项目的相关信息,点击“Finish”按钮,即可完成Web项目的新建工作:

在点击完“Finish”按钮之后,这时候发现Eclipse就开始从远程的库中下载构建Web项目所需要的相关东西了:

最后在Eclipse项目列表中发现有“Framework”项目,并在Tomcat下成功发布并可以访问,表明使用Eclipse的Maven插件新建Web项目成功了。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。