最近在切换Maven Repository路径时,eclipse中遇到了ArtifactDescriptorException的问题,而且一下就是400多个error。
该错误的详细描述如下:
ArtifactDescriptorException: Failed to read artifact descriptor for woodstox:wstx-asl:jar:3.2.7: ArtifactResolutionException: Failure to transfer woodstox:wstx-asl:pom:3.2.7 from https://repository.cloudera.com/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of cdh.snapshot.repo has elapsed or updates are forced. Original error: Could not transfer artifact woodstox:wstx-asl:pom:3.2.7 from/to cdh.snapshot.repo (https://repository.cloudera.com/content/repositories/snapshots): Failed to transfer https://repository.cloudera.com/content/repositories/snapshots/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom. Error code 409, The repository 'libs-snapshot-local' rejected the artifact 'libs-snapshot-local:woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom' due to its snapshot/release handling policy.
看上去是有什么东西无法下载,但
工程各种Clean、重新导入、Update Dependency、package、eclipse:eclipse都无效,切换到老的
Repository就没问题。去新的路径下看,对应的jar包也都在,又怀疑pom中有格式错误,各种调整也没有解决。
后来执行 mvn dependency:tree 时,发现这样一段信息:
[WARNING] POM for 'com.taobao.promotioncenter:promotion-common-client:pom:2.2.0:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
Downloading: http://mvnrepo.taobao.ali.com/mvn/repository/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom
[INFO] Unable to find resource 'woodstox:wstx-asl:pom:3.2.7' in repository central (http://mvnrepo.taobao.ali.com/mvn/repository)
Downloading: https://repository.cloudera.com/content/repositories/snapshots/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom
[WARNING] Unable to get resource 'woodstox:wstx-asl:pom:3.2.7' from repository cdh.snapshot.repo (https://repository.cloudera.com/content/repositories/snapshots): Error transferring file: Server returned HTTP response code: 502 for URL: https://repository.cloudera.com/content/repositories/snapshots/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom
Downloading: https://repository.cloudera.com/content/groups/cloudera-repos/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom
[WARNING] Unable to get resource 'woodstox:wstx-asl:pom:3.2.7' from repository cdh.repo (https://repository.cloudera.com/content/groups/cloudera-repos): Error transferring file: Server returned HTTP response code: 502 for URL: https://repository.cloudera.com/content/groups/cloudera-repos/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom
Downloading: http://people.apache.org/~rawson/repo//woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom
[INFO] Unable to find resource 'woodstox:wstx-asl:pom:3.2.7' in repository temp-thrift (http://people.apache.org/~rawson/repo/)
Downloading: http://mvnrepo.taobao.ali.com/mvn/repository/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom
[INFO] Unable to find resource 'woodstox:wstx-asl:pom:3.2.7' in repository java.net (http://download.java.net/maven/2/)
Downloading: http://repository.codehaus.org//woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom
[INFO] Unable to find resource 'woodstox:wstx-asl:pom:3.2.7' in repository codehaus (http://repository.codehaus.org/)
[WARNING] POM for 'com.taobao.hsf:hsf.services:pom:1.4:compile' is invalid.
可以看出,Maven尝试了各种下载地址仍没有成功下载这个jar包的信息,于是更倾向于无法下载的原因。
看了一下这个jar包的引用关系,是一个间接引用的非必需jar包,将其exclude掉后400多个error立即消失。
总结:
1. 该问题还是由于某个jar包相关的信息无法下载,导致Maven无法正确读取其pom中的信息,因此是ArtifactDescriptorException。
2. 其他400多个error是由于这一个问题jar包导致,可以随之一起修复。
3. 像这种实在无法下载的情况,最好的方式就是将其exclude掉。如果是必需的jar包,暂时不知道有什么好的方法。但必需的应该是很常用的jar包,不会出现这种无法下载的情况。
<原创文章,转载请注明出处>
该错误的详细描述如下:
ArtifactDescriptorException: Failed to read artifact descriptor for woodstox:wstx-asl:jar:3.2.7: ArtifactResolutionException: Failure to transfer woodstox:wstx-asl:pom:3.2.7 from https://repository.cloudera.com/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of cdh.snapshot.repo has elapsed or updates are forced. Original error: Could not transfer artifact woodstox:wstx-asl:pom:3.2.7 from/to cdh.snapshot.repo (https://repository.cloudera.com/content/repositories/snapshots): Failed to transfer https://repository.cloudera.com/content/repositories/snapshots/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom. Error code 409, The repository 'libs-snapshot-local' rejected the artifact 'libs-snapshot-local:woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom' due to its snapshot/release handling policy.
可以看出,Maven尝试了各种下载地址仍没有成功下载这个jar包的信息,于是更倾向于无法下载的原因。[WARNING] POM for 'com.taobao.promotioncenter:promotion-common-client:pom:2.2.0:compile' is invalid. Its dependencies (if any) will NOT be available to the current build. Downloading: http://mvnrepo.taobao.ali.com/mvn/repository/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom [INFO] Unable to find resource 'woodstox:wstx-asl:pom:3.2.7' in repository central (http://mvnrepo.taobao.ali.com/mvn/repository) Downloading: https://repository.cloudera.com/content/repositories/snapshots/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom [WARNING] Unable to get resource 'woodstox:wstx-asl:pom:3.2.7' from repository cdh.snapshot.repo (https://repository.cloudera.com/content/repositories/snapshots): Error transferring file: Server returned HTTP response code: 502 for URL: https://repository.cloudera.com/content/repositories/snapshots/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom Downloading: https://repository.cloudera.com/content/groups/cloudera-repos/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom [WARNING] Unable to get resource 'woodstox:wstx-asl:pom:3.2.7' from repository cdh.repo (https://repository.cloudera.com/content/groups/cloudera-repos): Error transferring file: Server returned HTTP response code: 502 for URL: https://repository.cloudera.com/content/groups/cloudera-repos/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom Downloading: http://people.apache.org/~rawson/repo//woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom [INFO] Unable to find resource 'woodstox:wstx-asl:pom:3.2.7' in repository temp-thrift (http://people.apache.org/~rawson/repo/) Downloading: http://mvnrepo.taobao.ali.com/mvn/repository/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom [INFO] Unable to find resource 'woodstox:wstx-asl:pom:3.2.7' in repository java.net (http://download.java.net/maven/2/) Downloading: http://repository.codehaus.org//woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.pom [INFO] Unable to find resource 'woodstox:wstx-asl:pom:3.2.7' in repository codehaus (http://repository.codehaus.org/) [WARNING] POM for 'com.taobao.hsf:hsf.services:pom:1.4:compile' is invalid.