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 -> [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.
Related
We have a maven project structure like this:
Parent
L A
L B
A depends on B
Both have various dependencies on other libs
Building this with mvn clean install works fine, but when we try to prune all dependencies as described here with
mvn dependency:purge-local-repository
We get an error saying that it can't resolve the dependency to B:jar:snapshot-version:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:purge-local-repository (default-cli) on project A: Failed to refresh project dependencies for: A:jar:4.0.1-SNAPSHOT: required artifacts missing:
[ERROR] B:jar:6.0-5
My current interpretation is that during an actual build B gets build first and can get resolved, but during the purge nothing gets build so the resolution fails. But the project is there and its dependencies should get purged. How can I fix this?
-DactTransitively=false
doesn't seem to change anything.
While it doesn't seem to be the exact issue referenced by #Tunaki the example in there let me try this:
mvn dependency:purge-local-repository -DreResolve=false
Which got rid of the exception but failed to actually reload the dependency I had problems with. At which point I came across this answer which made me try
mvn dependency:purge-local-repository -DreResolve=false -DactTransitively=false
which solved the problem although it seems to requesting the opposite of what I wanted to achieve :-/
This looks like a bug with the maven-dependency-plugin (JIRA issue MDEP-405) introduced by a regression in Maven 3.0.4.
From Paul Gier's comment:
I think the reason this happens is because in order to determine the full set of transitive dependencies to delete, the poms need to be available. If the poms were already resolved in the previous module, Maven won't re-resolve them again and just fails. So the dependency doesn't have a problem with the file already being deleted from the local repo, but the maven dependency resolution code fails when trying to resolve the same file twice in the same build.
You might try the build with Maven 3.0.3 because there was a change in this in Maven 3.0.4:
http://mail-archives.apache.org/mod_mbox/maven-dev/201210.mbox/%3C5752023.Vp0WJBo1vZ%40bigmax%3E
This is linked to the regression MNG-5366, that is currently unresolved.
I don't see any real work-around apart from downgrading Maven.
My build is failing with this error message (corporate stuff crossed out):
[ERROR] Failed to execute goal on project XXXX: Could not resolve
dependencies for project XXXX: The following artifacts could not be
resolved:
com.github.chrisbanes.actionbarpulltorefresh:library:jar:0.9.3,
com.github.castorflex.smoothprogressbar:library:jar:0.2.0: Cannot
access XXXX-release (http://repo.XXXX.corp/main/repo) in offline mode
and the artifact
com.github.chrisbanes.actionbarpulltorefresh:library:jar:0.9.3 has not
been downloaded from it before. -> [Help 1]
The funny thing is that actionbarpulltorefresh is not a dependency of this project. I double-checked and the string appears nowhere in the directory. It's a dependency of another project I built a couple of days ago, but not this one. It's also not mentioned in my users's settings.xml file, or anywhere in .m2 except that it's actually installed there.
Where could that error possibly be coming from?
It might be a transitive dependency, a dependency of a dependency.
This question might help you: How to determine which Maven dependency is needing a missing dependency?
I am using Maven to run a Java project. My issue is that I am not able to download the dependencies. It is giving the following error
[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.7.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.7.1: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central (http://repo1.maven.org/maven2): Failed to transfer http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.7.1/maven-surefire-plugin-2.7.1.pom. Error code 307, Temporary Redirect -> [Help 1]
The settings.xml is properly configured with the proxy details (since I am behind a proxy) Still, I am not able to access the maven repo to download.
UPDATE: Thanks a lot landal79.I revisited this issue after some time. Still this issue gives me a nightmare.
Currently, I am not able to create any Maven Project. I am 100% sure this is due to a proxy issue. But not able to
nail it down to where exactly the issue.
When I try creating a project selecting an archetype, I am not able to create a maven project. I am getting the below error
"Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-
quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Users\rrr.m2\repository)
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Users\rrr.m2\repository)"
I try creating this project through Eclipse. The settings.xml point to the right proxy ( cross checked with the Network connections dialog (window ->General->NetworkConenction Dialog). But the issue still persists.
So what I did was installed standalone Maven and create a maven project from command prompt. To my surprise,I am not able to download the archetypes in Maven Repo though other plugins are getting downloaded (Surefire plugin and JUNit jar for example)
Is there any work around to resolve the archetype download issue?
I tried your solution, but the issue still persists. When I create a simple maven project (without using any archetypes) I am getting "Unable to build Project " Error
PS: The proxy settings are defined in settings.xml and they are correct. Also, the eclipse proxy settings are correct (Since I am able to install plugins from Eclipse MarketPlace)
Eclipse experts - please help me resolve this issue. Thanks a lot in advance for help.
Thanks
I was compiling an "old" open sourced project, while encountered this problem:
[ERROR] Failed to execute goal on project .... Can not transfer artifact x:y:z from ...
the artifact x:y:z is not found from all repositories defined in the project pom.xml.
After looked up the effective pom.xml, I could not find any references to x:y:z.
How can I find out which artifact or plugin is requesting a missing dependency without analyze all transitive dependencies?
If you use eclipe - you can see dep tree like this: open pom.xml and tick "Dependency Hierarchy" tab.
Also you can try to use mvn dependency:tree but I am not totally sure that it will work if some of your deps are missing.
UPDATE: seems like both eclipse and dependency:tree require sucessfull artifact resolution to work whch is not your case.
In this case I guess you're left with 3 opttions:
clean your cache (wipe everything under ~/.m2/repository), run your build and do occurence search (search for something like "problematic-artifact-id") on files in your ~/.m2/repository. One or couple of the artifacts should reference the problematic artifact in their pom. This should give you a hint.
clean your cache and run your build with -X switch. This will put maven in verbosity mode and you should find some hints about what might reference dead dependency (point your attention on download order, what artifacts got resolved, check dependencies of resolved artifacts in their poms)
dumb as hell - comment/uncomment deps in your pom and see what causes the mentioned error.
I'm pretty new to troubleshooting Maven problems and need some direction. My project is in eclipse and I'm using the m2eclipse plugin. When i import my project to eclipse all dependencies are resolved and its business as usual. However when i deploy to one of my shared environments the mvn deploy is failing due to "package ... does not exist" exception on some Spring components. I'm also seeing alot of "cannot find symbol" issues.
The first thing i checked was the Settings.xml file I used locally against what the shared environment is using and they are the same.
Any suggestions on what else could be causing the deploy to fail? BTW my POM uses teh repositories tag to specify an additional repository however this doesnt seem to be having any affect on the failing deploy.
Thanks,
org.apache.maven.BuildFailureException: Compilation failure
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
Most likely your dependencies are using the wrong scope, which causes the libraries not be be included in e.g. the output war file.
As a first step I would confirm that your build passes on the command line and maybe share your pom file here.