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.
Q13. How do I determine which POM contains missing transitive dependency? Ans. If its already there in Maven local repository, We can add that as a dependency in the project pom file with its Group Id, Artifact Id and version.
In order to exclude these special dependencies from the main project, we can apply Maven's <optional> tag to them. This forces any user who wants to use those dependencies to declare them explicitly. However, it does not force those dependencies into a project that doesn't need them.
A project's dependency tree can be filtered to locate specific dependencies. For example, to find out why Velocity is being used by the Maven Dependency Plugin, we can execute the following in the project's directory: mvn dependency:tree -Dincludes=velocity:velocity.
You can get this information in the Maven Tool Window. First go to View → Tool Windows → Maven, to make sure that the Maven window is visible. The top-level elements in the tree are your direct dependencies, and the child elements are the transitive dependencies.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With