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

时间:2011-10-19 09:26:43

标签: maven

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

mvn archetype:generate -DarchetypeGroupId=org.graniteds.archetypes 
                       -DarchetypeArtifactId=graniteds-tide-spring-jpa-hibernate 
                       -DgroupId=org.example 
                       -DartifactId=gdsspringflex 
                       -Dversion=1.0-SNAPSHOT

(来自此链接的命令: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]

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

15 个答案:

答案 0 :(得分:71)

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

我尝试从GUI配置代理选项,但文档说maven没有读取它们。所以我检查了NetBeans FAQ here

您需要做的主要是在

下创建(如果它不存在)settings.xml
user.home/.m2/settings.xml

如果您没有,可以从

复制
netbeans.home/java/maven/conf/settings.xml

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

<proxies>
 <proxy>
   <active>true</active>
   <host>myproxy.host.net</host>
   <port>80</port>
 </proxy>
</proxies>

您必须检查代理配置并将其替换为

答案 1 :(得分:31)

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

  1. 转到D:\Maven\apache-maven-3.0.4-bin\apache-maven-3.0.4\conf(即您的maven安装文件夹)
  2. 复制settings.xml并将其粘贴到.m2文件夹中,该文件夹位于Windows计算机的用户文件夹中。
  3. 添加代理设置
  4. 这样的事情:

     <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>
    

答案 2 :(得分: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>

之前

 <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>

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

答案 3 :(得分:3)

在我的情况下,即使在传递代理凭据后也无法正常工作。

错误 - 忘了删除评论专栏。

<!-- proxy
 | Specification for one proxy, to be used in connecting to the network.

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>345325</username>
  <password>dfgasdfg</password>
  <host>proxy.abc.com</host>
  <port>8080</port>
  <nonProxyHosts>proxy.abc.com</nonProxyHosts>
</proxy>
|-->    ----------REMOVE THIS LINE AND CLOSE It above <proxy> tag

答案 4 :(得分:1)

我不建议你这样做但是在我的个人计算机上我禁用了防火墙,以便maven可以获得所需的插件。

答案 5 :(得分:1)

我遇到了完全相同的问题。我进入了我的IE设置 - >局域网设置。然后将地址复制为主机和端口作为端口,它工作正常。 以下是我更改的Settings.xml中代理标记的快照。

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <!--username>proxyuser</username>
  <password>proxypass</password-->
  <host>webtitan</host>
  <port>8881</port>
  <!--nonProxyHosts>local.net|some.host.com</nonProxyHosts-->
</proxy>

答案 6 :(得分:1)

我必须将我的密码更改为user.home / .m2 / settings.xml文件中的最新密码!

答案 7 :(得分:1)

谢天谢地......

编辑setting.xml

并用此

替换代理

100%工作

<proxy>      
  <active>true</active>
  <protocol>http</protocol>
  <username>your username</username>
  <password>password</password>    
  <host>proxy.host.net</host>
  <port>80</port>  

答案 8 :(得分:0)

当我们更改apache-maven的版本

时,这个问题就解决了

我遇到了它,当我使用apache-maven-2.2.1

时它就解决了

答案 9 :(得分:0)

我遇到了同样的问题,因为我在settings.xml代理配置中使用了端口80而不是8080

答案 10 :(得分:0)

Mac OSX 10.7.5:我尝试在/ conf目录中以及〜/ .m2目录中的settings.xml文件中设置我的代理(如上面的海报所述),但我仍然遇到此错误。我下载了最新版本的Maven(3.1.1),并设置了我的PATH变量以反映最新的安装,它立即为我提供了工具,没有任何错误。

答案 11 :(得分:0)

我在Windows

中遇到了同样的问题

并且由于settings.xml文件中的代理配置已更改

,因此无效

因此,找到并编辑\conf文件夹中的文件,例如:C:\Program Files\apache-maven-3.2.5\conf

<proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>jorgesys</username>
      <password>supercalifragilisticoespialidoso</password>
      <host>proxyjorgesys</host>
      <port>8080</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>
  • 在我的情况下,我不得不从端口80变为8080
  • 如果您无法编辑位于/program files内的此文件,则可以复制该文件,编辑该文件并替换位于/program files文件夹中的文件。

答案 12 :(得分:0)

在我的情况下,即使我的系统不在代理之后,我也遇到了同样的问题。我能够通过在mvn archetype:generate

之前键入mvn help:archetype来解决

答案 13 :(得分:0)

如果您创建了新的settings.xml文件而不是从其他地方复制它,请记住将标记放在其中:

  

public class FactionService { @Autowired private FactionDao dao; @Transactional public void delete(int id){ dao.delete(id); } }

答案 14 :(得分:0)

对我来说,在VM中运行Mint 19时,第maven is not able to download anything from central because ssl don't work页上给出的解决方案有效:

<script src="https://d3js.org/d3.v5.min.js"></script>
<svg>
  <circle r="50"></circle>
</svg>
相关问题