创建maven工程时失败情况

来源:互联网 发布:网站数据库放在哪里 编辑:程序博客网 时间:2024/05/29 11:11

Eclipse+ maven工程

在maven成功解压,并配置好环境变量的情况下。

1.出现的问题

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELEASE from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-arc hetype-webapp/maven-metadata.xml in local (D:\programfiles\.m2\repository)Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom: RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (D:\programfiles\.m2\repository) ;

如图:

  


解决思路:

      1、失败的方法:

           参考网上一堆的答案,比如在Eclipse Maven配置中添加新的Catalog配置:均无法正常下载jar包,导致新建maven项目失败。

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

      2、成功的方法:修改settings.xml的mirrors配置,使用国内较快的镜像地址,如下

<mirror>    
      <id>repo2</id>    
      <mirrorOf>central</mirrorOf>    
      <name>Human Readable Name for this Mirror.</name>    
      <url>http://repo2.maven.org/maven2/</url>    
    </mirror>

<mirror>    
      <id>net-cn</id>    
      <mirrorOf>central</mirrorOf>    
      <name>Human Readable Name for this Mirror.</name>    
      <url>http://maven.net.cn/content/groups/public/</url>     
     </mirror>  
     
     <mirror>    
      <id>jboss-public-repository-group</id>    
      <mirrorOf>central</mirrorOf>    
      <name>JBoss Public Repository Group</name>    
     <url>http://repository.jboss.org/nexus/content/groups/public</url>    
</mirror>  

0 0
原创粉丝点击