mvn install失败:Failed to read artifact descriptor org.apache.maven.plugins:maven-install-plugin:jar:2

来源:互联网 发布:js缺省参数 编辑:程序博客网 时间:2024/06/05 23:42

之前一直用笔记本开发,今天把台式机环境搞好了,从git拉了工程,maven工程install出现错误,详情:

[INFO] Scanning for projects...[INFO] Downloading from nexus: http://maven.aliyun.com/nexus/content/groups/public/com/bonc/ti/ti-parent/1.0.6-SNAPSHOT/maven-metadata.xml[WARNING] Could not transfer metadata com.bonc.ti:ti-parent:1.0.6-SNAPSHOT/maven-metadata.xml from/to nexus (http://maven.aliyun.com/nexus/content/groups/public/): Operation not supported: connect[INFO] [INFO] ------------------------------------------------------------------------[INFO] Building vbap data model 3.0.7-SNAPSHOT[INFO] ------------------------------------------------------------------------[INFO] Downloading from nexus: http://maven.aliyun.com/nexus/content/groups/public/org/apache/maven/plugins/maven-install-plugin/2.5.2/maven-install-plugin-2.5.2.pom[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 1.307 s[INFO] Finished at: 2017-12-19T19:50:31+08:00[INFO] Final Memory: 15M/155M[INFO] ------------------------------------------------------------------------[ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.5.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.5.2: Could not transfer artifact org.apache.maven.plugins:maven-install-plugin:pom:2.5.2 from/to nexus (http://maven.aliyun.com/nexus/content/groups/public/): Operation not supported: connect -> [Help 1][ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
显示在不能从仓库传输maven-install-plugin:2.5.2插件,因为maven的install操作的时候是通过maven-install-plugin插件执行的,首先要保证install插件的存在。访问http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException可以看到造成PluginResolutionException这个异常的原因有6个:

1.试图访问一个在仓库中不存在的插件,比如说把group id, artifact id 或者 version版本号写错了。

2.访问的插件是一个没有发布到中央库的第三方插件,但是你的pom文件或者settings.xml文件中没有<pluginRepository>标签指明从该仓库下载插件。这里要注意的一点是,<repository>定义在查找插件及其依赖的时候是不起作用的,仅<pluginRepository>对插件的下载起作用。

3.插件仓库需要权限验证,但是Maven没有通过权限验证,所以访问不了仓库服务器,所以这时候应该去看settings.xml文件中的<server>定义:

<server>  <!-- server(服务器)的id,对应着mirrors中的id,指定了该地址的验证信息 -->  <id>nexus</id>  <username>xxx</username>  <password>xxx</password></server>
4.网络问题,比如说有的地址需要vpn才能访问,那就需要代理配置等。settings.xml文件中设置代理:
<proxies> <proxy>  <id>optional</id>  <active>true</active>  <protocol>http</protocol>  <host>代理的ip地址</host>  <port>端口</port> </proxy></proxies>
5.Maven在保存插件到本地时失败。可以根据LocalRepositoryNotAccessibleException 了解更多信息。
6.配置的插件仓库对你需要的插件的不可见的,比如说我要访问一个SNAPSHOT快照版本的插件,在正式仓库中就无法访问到,这个时候应该检查settings.xml文件中的插件仓库配置:

<pluginRepositories>  <pluginRepository>    <id>central</id>    <url>http://central</url>    <releases>      <enabled>true</enabled>    </releases>    <snapshots>      <enabled>true</enabled>    </snapshots>  </pluginRepository></pluginRepositories>

回到我自己的问题,我去看仓库中又是存在这个版本插件的,所以不存在1的问题。也不是2的问题。

在错误中显示了Operation not supported: connect这样的错误,表示连接maven仓库的操作不支持?看不懂。

说连接有问题,我能下载其他的依赖包说明是没问题的。然后就去看settings.xml文件的配置项,也没有什么问题。

下面是stackoverflow上对这个问题的一些解决方法:

1.右击工程-> maven -> update-project -> 勾选force to update snapshot/release -> OK

2.把.m2/下所有的文件删除,重新下载一遍。

3.把settings.xml文件copy一份到.m2/文件夹下。

4.检查eclipse中的settings文件配置:Windows->preferences->maven->User Settings

我回到eclipse中右击工程update project,发现不行,然后把settings.xml文件copy一份到了.m2/文件夹下,运行mvn install 还是报错,气得我重启了一波电脑,居然就成功了!!!

如果上述方案没有帮到您,还望手下留情,谢谢!

参考链接:

http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

https://stackoverflow.com/questions/18728792/failed-to-read-artifact-descriptor-for-artifact-present-in-my-localhost-nexus-re

https://stackoverflow.com/questions/10729394/artifactdescriptorexception-failed-to-read-artifact-descriptor-maven-error

如果还有相关的问题可以参考:

https://stackoverflow.com/questions/12533885/could-not-calculate-build-plan-plugin-org-apache-maven-pluginsmaven-resources

https://stackoverflow.com/questions/6642146/maven-failed-to-read-artifact-descriptor



阅读全文
0 0
原创粉丝点击