开发者

Maven dependency hell - previously removed repository appears during my build

开发者 https://www.devze.com 2023-03-27 12:29 出处:网络
Our project used to have a repository that now is deprecated jboss - hibernate bug explained here, we updated every single pom we had with the new repository, and it seemed to work just fine until tod

Our project used to have a repository that now is deprecated jboss - hibernate bug explained here, we updated every single pom we had with the new repository, and it seemed to work just fine until today, when I decided to checkout the project and do a clean build into a new machine.

Now, I've got maven complaining that it can't reach the old repository. I've grepped the whole filesystem checking for the culprit and couldn't find it. But still I've got this

Failed to read artifact descriptor for org.jboss.aop:jboss-aop:jar:2.0.0-SNAPSHOT: Could not transfer artifact org.jboss.aop:jboss-aop:pom:2.0.0-SNAPSHOT from/to jboss (http://repository.jboss.com/maven2): Access denied to: http://repository.jboss.com/maven2/org/jboss/aop/jboss-aop/2.0.0-SNAPSHOT/jboss-aop-2.0.0-SNAPSHOT.pom -> 开发者_StackOverflow社区[Help 1]

I have no idea what's going on, my theory (besides that this could be an x-file) is that other dependency somehow managed to include this repo? Am I right? How can I check this?

I tried to build the dependency tree (mvn dependency:tree) to see who is the one that tries to include it, but since the whole project can't build I can't get the dep:tree ~grin~

Can anybody explain me what exactly is wrong here? how can I debug it? "BTW -e option doesn't bring any other useful info, still I pasted it below for any eagle-eye expert out there :)"

So far, I've started to copy the whole ~/.m2/repository from other machine to the new one, hopefully this will make the trick. But still, I was expecting maven to download and build the project from scratch as it's supposed to do

Here is the stacktrace

Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.jboss.aop:jboss-aop:jar:2.0.0-SNAPSHOT
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:282)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:172)
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:419)
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:533)
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:533)
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:533)
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:243)
    ... 25 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.jboss.aop:jboss-aop:pom:2.0.0-SNAPSHOT from/to jboss (http://repository.jboss.com/maven2): Access denied to: http://repository.jboss.com/maven2/org/jboss/aop/jboss-aop/2.0.0-SNAPSHOT/jboss-aop-2.0.0-SNAPSHOT.pom
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:541)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:220)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:197)
        at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:267)
        ... 31 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact org.jboss.aop:jboss-aop:pom:2.0.0-SNAPSHOT from/to jboss (http://repository.jboss.com/maven2): Access denied to: http://repository.jboss.com/maven2/org/jboss/aop/jboss-aop/2.0.0-SNAPSHOT/jboss-aop-2.0.0-SNAPSHOT.pom
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:949)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:940)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.flush(WagonRepositoryConnector.java:695)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.flush(WagonRepositoryConnector.java:689)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.get(WagonRepositoryConnector.java:445)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:460)
        ... 34 more
Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Access denied to: http://repository.jboss.com/maven2/org/jboss/aop/jboss-aop/2.0.0-SNAPSHOT/jboss-aop-2.0.0-SNAPSHOT.pom
        at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:119)
        at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
        at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
        at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
        at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:608)
        at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:64)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:680)

Thanks in advance

UPDATE 08/10/2011

Seems that the problem is related to maven3. Last update from apple pushed some java changes including maven3. After download and set up maven2 and perform a full "mvn clean compile build" problem disappeared.

I'll update this thread when I've got more info on the issue

Thanks to everybody that answered and gave ideas. Your help is very much appreciated.


Instead of a dependency tree, use

mvn help:effective-pom

and search the output of that for the repo. If a multi-module build, make sure to run it at the top level to get all the poms at once. If it's not mentioned there, double check ~/.m2/settings.xml and $M2_HOME/conf/settings.xml for it. It's definitely somewhere in your file system. Maven doesn't just magically add repos.


If you use Eclipse, M2Eclipse's Dependency Graph is an alternative to dependency:tree which might work without requiring Maven to run against the POM.

When looking at dependency POMs for repos, you also need to look at parents/ancestors of those POMs.


Perhaps you should relook at the specified dependency - org.jboss.aop:jboss-aop:jar:2.0.0-SNAPSHOT. It looks like does not exist in jboss repository. You could try 2.0.0.GA instead.


You "updated every single pom ... with the new repository"? Don't put repositories in your poms.

http://www.sonatype.com/people/2009/02/why-putting-repositories-in-your-poms-is-a-bad-idea/

I suspect Maven is trying to hit that repo because it is being referenced in the pom of a transitive dependency (Maven 3 uses slightly different dependency resolution than Maven 2), or else there may be something in the compatibility notes about repositories that is affecting you.

0

精彩评论

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

关注公众号