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.maven.apache.org/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.maven.apache.org/maven2): Remote host closed connection during handshake
Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from https://repo.maven.apache.org/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.maven.apache.org/maven2): Remote host closed connection during handshake
解決方案:
在Eclipse中打開“Preferences”--偏好設置窗口,在左側列表中找到“Maven”的配置項,在展開列表之后選擇“Archetypes”;
點擊右側的“Add Remote Catalog”按鈕,在彈出的窗口中,在“Catalog File”輸入框中輸入:
http://repo1.maven.org/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項目成功了。
總結
以上是生活随笔為你收集整理的Eclipse使用Maven插件创建Web项目时出错:Could not resolve archetype org.apache.maven.archetypes的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Linux】基础特性与常见系统管理命令
- 下一篇: 注册MSComm方法