Maven:无法检索插件描述符错误

Bas*_*ith 63 maven

我配置了Maven 3.0.3并尝试使用此命令使用archetypes下载示例项目:

mvn archetype:generate -DarchetypeGroupId=org.graniteds.archetypes 
                       -DarchetypeArtifactId=graniteds-tide-spring-jpa-hibernate 
                       -DgroupId=org.example 
                       -DartifactId=gdsspringflex 
                       -Dversion=1.0-SNAPSHOT
Run Code Online (Sandbox Code Playgroud)

(来自此链接的命令:http://java.dzone.com/articles/enterprise-ria-spring-3-flex-4)

我收到了这个错误:

Downloading: repo1.maven.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.4.1: Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1

Downloading: repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3.1.pom

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.3.1: Plugin org.apache.maven.plugins:maven-install-plugin:2.3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1
.
.
.
Downloading: repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml

[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (repo1.maven.org/maven2): Error transferring file: Connection refused: connect

[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (repo1.maven.org/maven2): Error transferring file: Connection refused: connect
Downloading: repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml

[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (repo1.maven.org/maven2): Error transferring file: Connection refused: connect

[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (repo1.maven.org/maven2): Error transferring file: Connection refused: connect
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.479s
[INFO] Finished at: Tue Oct 18 12:44:58 BST 2011
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------

[ERROR] No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\krsl1254\.m2\repository), central (repo1.maven.org/maven2)] -> [Help 1]
Run Code Online (Sandbox Code Playgroud)

我尝试搜索一些类似的帖子,但无法得到答案.我尝试在settings.xml中更改代理设置,但它仍然无法正常工作.你能帮帮我吗?

Sna*_*ers 73

我有同样的错误.在我的情况下,我使用Netbeans 7.1.2,我发布这个是因为也许有人和我一样在这里结束.

我尝试从GUI配置代理选项,但文档说maven不会读取它们.所以我在这里查看了NetBeans FAQ :

你要做的主要是创建(如果它不存在)一个settings.xml

user.home/.m2/settings.xml
Run Code Online (Sandbox Code Playgroud)

如果你没有它,你可以复制

netbeans.home/java/maven/conf/settings.xml
Run Code Online (Sandbox Code Playgroud)

然后取消注释,如果你已经拥有它,否则只需填写此部分:

<proxies>
 <proxy>
   <active>true</active>
   <host>myproxy.host.net</host>
   <port>80</port>
 </proxy>
</proxies>
Run Code Online (Sandbox Code Playgroud)

你必须检查你的代理配置并在那里替换它


小智 31

我在Eclipse中遇到了类似的问题,并且与Sanders解决它的步骤相同.这是因为代理限制了对maven存储库的调用

  1. 转到D:\Maven\apache-maven-3.0.4-bin\apache-maven-3.0.4\conf(即您的maven安装文件夹)
  2. settings.xml其复制并粘贴到.m2Windows计算机的users文件夹中的文件夹中.
  3. 添加代理设置

像这样的东西:

 <proxies>
    <!-- proxy
      Specification for one proxy, to be used in connecting to the network.
     -->
    <proxy>      
      <active>true</active>
      <protocol>http</protocol>
      <username>your username</username>
      <password>password</password>    
      <host>proxy.host.net</host>
      <port>80</port>  
    </proxy>

  </proxies>
Run Code Online (Sandbox Code Playgroud)

  • 只是为了做一个笔记.如果您的maven路径设置正确,则无需将`settings.xml`从`conf`目录传输到`.m2`文件夹.原因是`mvn`首先从`conf/settting.xml`加载其全局设置,然后从.m2文件夹加载本地设置.这可以从日志`[DEBUG]中读取从C:\ apache-maven-3.1.1-bin\conf\settings.xml [DEBUG]读取全局设置从C:\.m2\settings.xml中读取用户设置 (3认同)

fib*_*air 6

我必须把

 <proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  host>Your proxy host</host>
  <port>proxy host ip</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
Run Code Online (Sandbox Code Playgroud)

之前

 <proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>https</protocol>
  <host>Your proxy host</host>
  <port>proxy host ip</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
Run Code Online (Sandbox Code Playgroud)

很奇怪,但是.!!!, <protocol>http</protocol>必须来之前 <protocol>https</protocol>.它解决了我的问题.希望它可以帮助那些在启用代理设置后面临连接问题的人conf/settings.xml.