开发者

How to troubleshoot which transitive dependency's POM is referring to a defunct Maven repository?

开发者 https://www.devze.com 2023-03-13 12:09 出处:网络
With Maven 3.0.3 I\'m getting a \"Could not resolve dependencies...\" error for a project I\'m working on:

With Maven 3.0.3 I'm getting a "Could not resolve dependencies..." error for a project I'm working on:

[ERROR] Failed to execute goal on project arquillian-jetty-embedded-6.1: 
Could not resolve dependencies for project 
org.jboss.arquillian.container:arquillian-jetty-embedded-6.1:jar:1.0.0-SNAPSHOT: 
Failed to collect dependencies for [
org.jboss.arquillian.container:arquillian-container-spi:jar:1.0.0.CR1-SNAPSHOT (compile), 
org.jboss.arquillian.container:arquillian-container-test-spi:jar:1.0.0.CR1-SNAPSHOT (compile), 
org.jboss.arquillian.protocol:arquillian-protocol-servlet:jar:1.0.0.CR1-SNAPSHOT (compile), 
org.jboss.arquillian.testenricher:arquillian-testenricher-cdi:jar:1.0.0.CR1-SNAPSHOT (compile), 
org.jboss.arquillian.testenricher:arquillian-testenricher-resource:jar:1.0.0.CR1-SNAPSHOT (compile), 
org.jboss.arquillian.testenricher:arquillian-testenricher-initialcontext:jar:1.0.0.CR1-SNAPSHOT (compile), 
org.jboss.shrinkwrap.container:shrinkwrap-container-jetty-60:jar:1.0.0-beta-1 (compile), 
org.mortbay.jetty:jetty:jar:6.1.12 (provided), 
org.mortbay.jetty:jetty-plus:jar:6.1.12 (provided), 
org.jboss.arquillian.junit:arquillian-junit-container:jar:1.0.0.CR1-SNAPSHOT (test), 
junit:junit:jar:4.8.1 (test), 
javax.enterprise:cdi-api:jar:1.0 (test), 
org.mortbay.jetty:jetty-na开发者_Python百科ming:jar:6.1.12 (test), 
org.glassfish.web:el-impl:jar:2.2 (test), 
javax.servlet.jsp:jsp-api:jar:2.2 (test), 
com.h2database:h2:jar:1.2.138 (test), 
org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven:jar:1.0.0-beta-2 (test)]: 
Failed to read artifact descriptor for org.jboss.interceptor:jboss-interceptor-api:jar:1.1: 
Could not transfer artifact org.jboss.interceptor:jboss-interceptor-api:pom:1.1 
from/to repository.jboss.org (http://repository.jboss.org/maven2): 
Access denied to: 
http://repository.jboss.org/maven2/org/jboss/interceptor/jboss-interceptor-api/1.1/jboss-interceptor-api-1.1.pom -> 
[Help 1]

I know the error is occurring because a dead repository is being referenced, and that I can work around it by configuring an active mirror for that repository in my settings.xml. I know the artifact in question, jboss-interceptor-api, is not a direct dependency of the project I'm working on, nor is the project referencing the dead repository directly. What's not clear is how could I determine the offending transitive dependency and its lineage to the project in question? I'd like to correct the underlying issue, or at least inform those who could.

I've searched my local repository and found several references to the dead repo, but none of those artifacts are amongst the dependencies listed in the above error message. I get the error trying to run mvn -U dependency:tree on the project, so no help there either. I'm also not seeing any clues in the -X debug output, though I could post it all if desired.


What Samuel says is not true -- any pom.xml file can include a <repositories> stanza to define a repo that it will pull artifacts from. It is not a best practice (or even an acceptable one!), but it does happen. I had this happen with some pre-released EclipseLink artifacts a while back.

However, since we know the offending POM has been downloaded to your machine (else Maven wouldn't complain) then search your local ~/.m2 first for any poms that hols a <repositories> stanza. On Linux, I'd do this:

grep -r \<repositories\> .

and then I'd start looking through all those suspect files. I have a pretty big project, but running that command on my machine results in only 30 offending poms.

I'm and sure an awk expert could give you a better command to run that would return those potential files and search them again for the invalid repo.

Anyway, hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消