问题
I am trying to build an old Maven project and I'm getting the error:
[ERROR] Failed to execute goal on project myapp: Could not resolve dependencies for project com.initech.myapp:war:${buildVersion}: Failure to find tangosol:tangosol-coherence:jar:3.3-rc1 in http://mvnrepo.initech.com/archiva/repository/initechrepo was cached in the local repository, resolution will not be reattempted until the update interval of initechrepo has elapsed or updates are forced -> [Help 1]
I looked in the pom.xml
of MyApp and there is no mention of "tangosol" and there is no parent POM so I figure this must be a transitive dependency.
Normally, I can use the Maven Dependency plugin on the command line with mvn dependency:tree to display transitive dependencies. However, since the dependency is missing, the build fails and errors out instead of displaying the tree.
How can I get the cause of missing transitive dependency even if the build is failing?
EDIT: I am aware of why it failed, the artifact is missing from our local repository and the central repository, the question is which of my dependencies is asking for it.
回答1:
There should be a better way, but if you run the command in debug mode (ie -X
so the full command becomes mvn -X dependency:tree
) then you'll see the trace printed out before the build dies:
...
[DEBUG] org.springmodules:spring-modules-cache:jar:0.9:compile
[DEBUG] opensymphony:oscache:jar:2.3:compile
[DEBUG] tangosol:tangosol-coherence:jar:3.3-rc1:compile
[DEBUG] oro:oro:jar:2.0.8:compile
[DEBUG] org.apache.jcs:jcs:jar:1.3:compile
[DEBUG] concurrent:concurrent:jar:1.0:compile
...
better answers are welcome.
回答2:
I am wondering why maven didn't download the required dependency from the MAVEN CENTRAL REPO , if it is not available in your local repository.
mvn dependency:tree is useful to see the hierarchy , that means it can tell you which jar will depend on which others jars.
So, what i can guess from here is that required jar tangosol-coherence
is missing in your internal nexus repository. i.e
http://mvnrepo.initech.com/archiva/repository/initechrepo
So, to overcome this problem either you have to install the required jar in your internal nexus repository or as a temporary solution you can download that jar and put it into your local system repository, so that you can have a successful build.
Thanks
来源:https://stackoverflow.com/questions/17978768/how-to-determine-which-maven-dependency-is-needing-a-missing-dependency