Eclipse创建Maven的web项目报错误:Could not resolve archetype org.apache.maven.archetypes:maven-archetype-weba

报错代码
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 http://maven.aliyun.com/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus-aliyun has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public): maven.aliyun.com Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from http://maven.aliyun.com/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus-aliyun has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:1.0 from/to nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public): maven.aliyun.com
原因:
    1、Catalog 相关类型缺失;

    2、ide下载相关jar包时未能完整下载
针对以上两种原因的解决方案如下:

    1、配置Catalog

          在eclipse中,点击window-->preferences-->maven-->archetype,在archetype页面中点击 “Add Remote Catalog”,在弹出框的catalog File输入框中填写“http://repo1.maven.org/maven2/archetype-catalog.xml”(引号不要),下面description根据自己喜好填写。然后再次创建maven项目时选择自己刚才新建的catalog,然后再选择 org.apache.maven.archetypes  maven-archetype-webapp;

     2、重新下载maven-archetype-webapp-1.0.jar 

            如果以上方法未能解决问题,那就重新下载maven-archetype-webapp-1.0.jar即可。方法为:进入maven本地仓库org\apache\maven\archetypes\maven-archetype-webapp\1.0目录下删除.lastUpdate文件,当再次创建web时项目时,ide会自动下载相关的jar包。

       

        注:有时候可能创建时不是报的此错,比如什么plugin无法找到,此时也可尝试用上面的第2种方式,只是要注意文件路径为   “Could not resolve”后面的那个xxx.xxx.xxx...文件夹,找到对应的.lastUpdate文件删除掉。

猜你喜欢

转载自blog.csdn.net/qq_41323013/article/details/82661180