eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误

一、错误描述


eclipse新建maven-archetype-webapp项目时报错:


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



eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第1张图片



eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第2张图片


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 maven-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 maven-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 maven-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 maven-aliyun (http://maven.aliyun.com/nexus/content/groups/public/): maven.aliyun.com




出现这种问题的主要原因就是在仓库中找不到maven-archetype-webapp-1.0.jar,我配置的是阿里巴巴的仓库。


二、解决方法


网上的两种解决方式:


第一种方法:


1.在Eclipse Maven配置中添加新的Catalog配置:


   http://repo1.maven.org/maven2/archetype-catalog.xml



eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第3张图片


点击OK,然后点击Apply。


接下来在使用刚添加的catalog创建web工程


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第4张图片


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第5张图片



点击Finish还是报错


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第6张图片


第一种方法不行。


第二种方法:


2.1从http://maven.ibiblio.org/maven2/org/apache/maven/archetypes/ 下载最新版maven-archetype-webapp-1.0.jar


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第7张图片


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第8张图片


 2.2 命令行到下载目录下执行mvn install:install-file -DgroupId=org.apache.maven.archetypes -DartifactId=maven-archetype-webapp -Dversion=1.0 -Dpackaging=jar -Dfile=maven-archetype-webapp-1.0.jar


报错


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第9张图片


以上报错的原因是:在settings.xml 文件中 mirrors出了问题。

然后在setting.xml配置文件上面我添加了一个新的mirror,添加后如下:

eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第10张图片



  
  
      maven-aliyun
      *
      http://maven.aliyun.com/nexus/content/groups/public/
   
	
	     
       
      ibiblio.org    
      ibiblio Mirror of http://repo1.maven.org/maven2/    
      http://mirrors.ibiblio.org/pub/mirrors/maven2    
      central    
     

	

进入那个目录,然后在控制台下我重新输入:


mvn install:install-file -DgroupId=org.apache.maven.archetypes -DartifactId= maven-archetype-webapp  -Dversion=1.0 -Dpackaging=jar -Dfile= maven-archetype-webapp-1.0.jar


回车,就可以看到重新下载了好多的jar包文件。


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第11张图片


然后从新新建maven-webapp项目


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第12张图片


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第13张图片


还是报错。。。。


然后选择这个类型的


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第14张图片


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第15张图片


发现他已经在下载了。。





然后又报这种错


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第16张图片


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第17张图片


最后没办法,想到有可能是阿里云的那个仓库的原因,然后把它屏蔽掉!!


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第18张图片


然后再新建maven webapp项目就可以了。。。。


eclipse报: Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:1.0 错误_第19张图片



你可能感兴趣的:(Maven)