How to determine which Maven dependency is needing a missing dependency? - maven

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.

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.

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

Related

Q: “the pom for XXX is missing, no dependency information available”,but the dependency is already in the Nexus repository

while running mvn packaging, there is a warming shown in log.
[WARNING] The POM for com.yueyue:order-search-interface:jar:1.2.1.SNAPSHOT is missing, no dependency information available
and the compiling is failed in the end with the error as following.
[ERROR] Failed to execute goal on project dispatch-admin: Could not resolve dependencies for project com.yueyue:dispatch-admin:jar:2.0.0-SNAPSHOT: Could not find artifact com.yueyue:order-search-interface:jar:1.2.1.SNAPSHOT in bailongma_repo2 (http://192.168.200.224:8081/repository/bailongma_repo2/) -> [Help 1]
but the dependency is already in the maven-snapshots which is in the "bailongma_repo2" group repo.
by the way, this dependency is also in a remote repo which is as a proxy repo "aliyun_snapshot2" in "bailongma_repo2" group repo. the structure of "bailongma_repo2" group repo is as following.
what should i check first for this problem? many thanks in advance!

Could not find artifact org.wildfly.core:wildfly-coer-parent:pom:myVersion in jboss-public-repository-group

I am using Maven for my project. I have a parent project myProjectA and when I do mvn clean install it builds successfully. myProjectA has multiple children, one of which is "childA1". This childA1 calls a plugin childB1 from myProjectB.
The problem is that when I try to do mvn clean install on childA1 then it fails with error:
Plugin my-maven-plugin:0.1-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for my-maven-plugin:jar:0.1-SNAPSHOT: Failure to find org.wildfly.core:wildfly-core-parent:pom:myVersion in http://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-public-repository-group has elapsed or updates are forced
I understand from the error that the dependency org.wildfly.core in my-maven-plugin is not found. This dependency does not appear explicitly in the pom of childA1 or childB1. So to try to solve my problem I added the dependency to childB1 and did mvn clean install on childB1, the dependency was resolved and build was successful. While doing this I saw that the dependency was in fact downloaded from http://mynexus/nexus/content/groups/public and not the jboss repository that childA1 tries to get it from.
I looked at the "effective pom" tab (in Eclipse) of childA1 and childB1 and there I saw that the correct repository, mynexus, was listed and not the jboss repository.
Other things I tried is running with -U and I made sure to build myProjectA before building childA1. Unfortunately this did not solve my problem. Any suggestions how to fix it are welcome.

_remote.repositories prevents maven from resolving remote parent

I have my company parent pom in releases repository on a company Nexus instance.
I have mirror settings of <mirrorOf>external:*,!central</mirrorOf>, I don't want to proxy central since our Nexus is a bit slow.
When I have a maven project, with parent set like:
<parent>
<groupId>com.acme.maven</groupId>
<artifactId>parent-pom</artifactId>
<version>2</version>
<relativePath />
</parent>
and the parent-pom project is not available in local repository the build will fail -- this is as expected so far.
However if I download the parent-pom using dependency:get goal, the pom file gets downloaded to local repository. However when I try to build the project it fails with:
[exec] [ERROR] The project com.acme:test:0.0.1-SNAPSHOT (/home/acme/pom.xml) has 1 error
[exec] [ERROR] Non-resolvable parent POM: Failure to find com.acme.maven:parent-pom:pom:2 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at no local POM # line 5, column 13 -> [Help 2]
Now if I remove the _remote.repositories file (and only that file) from .m2/repository/com/acme/maven/parent-pom/2/ the build will succeed.
I have some kind of a workaround, but manually removing internal files from maven repository doesn't sound like a good idea. How can avoid it?
Also I have no idea why is this happening, some explanation will be much appreciated.
Other approaches:
maven-ant tasks dependencies task works (_remote.repositories file doesn't appear at all)
trying to build with -U
using dependency:copy fails
using dependency:list on a pom.xml having the parent-pom as dependency also fails
_remote.repositories content:
#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice.
#Mon Sep 14 19:59:41 CEST 2015
parent-pom-2.pom>internal-repo=
I think the answer is here:
Maven 3.0+ enforces that downloaded artifacts were resolved from a
repository url/id that matches an url available for the current
session.
..
IIRC there is a CLI option that you can enabled in Maven 3.1.1 that
tells Maven "I know what I am doing and don't make that check this
time" i.e.
--legacy-local-repository
Indeed adding --legacy-local-repository to the dependency:get invocation makes it not produce the _remote.repositories, and the parent-pom can be resolved.
Ant's dependencies task behaviour can, I think, be explained by it using Maven 2 code.

Building Valkyrie RCP

I'm trying to build Valkyrie RCP from the 1.2 release. According to their instructions, it should be easy: "Just clone the repository, and then use a mvn install command."
However, when I try the command, I get the following error:
[ERROR] Failed to execute goal on project valkyrie-rcp-core: Could not
resolve dependencies for project dk.navicon:valkyrie-rcp-core:jar:1.2:
Failure to find com.l2fprod:l2fprod-common-all:jar:7.3 in
http://repo.maven.apache.org/maven2 was cached in the local
repository, resolution will not be reattempted until the update
interval of central has elapsed or updates are forced -> [Help 1]
I can see that l2fprod-common-all-7.3.jar is included in the dependencies folder but Maven seems to be unaware of that. How should I resolve this problem?
Actually, it's now possible to build it using Gradle, which doesn't have the dependency issues . Also, there's a dependencies folder with batch scripts to install the missing dependencies if you still wish to use Maven.
As of 2.0 Valkyrie RCP will use Gradle.
The problem is that the given version of that dependency does not exist in Maven Central only older versions.
They would probably suggest you do a mvn install first on the file in the dependencies folder, then.
Try go down in deps and do a
mvn install -DgroupId=com.l2fprod -DartifactId=l2fprod-common-all -Dversion=7.3 -Dpackaging=jar -Dfile=l2fprod-common-all-7.3.jar
That would get you past that point locally.
After that re-execute your project build with a -Uoption.
Long term is to find the artifact and include it in a repository that is searchable from your maven settings or project profile.

Update interval of Maven Central Repo

Having zero experience with Maven, I am running a mvn clean install on a project and this is the error I get:
[ERROR] Failed to execute goal on project dnasequencing.CompaNY.com: Could not resolve dependencies for project com.CompaNY.dnasequencing:dnasequencing.
CompaNY.com:war:1.0-SNAPSHOT: The following artifacts could not be resolved: dsr-kepler:dsr-kepler:jar:0.0.1-SNAPSHOT, dsr-parser:dsr-parser:jar:0.0.1-
SNAPSHOT: Failure to find dsr-kepler:dsr-kepler:jar:0.0.1-SNAPSHOT in http://repo1.maven.org/maven2/ was cached in the local repository, resolution
will not be reattempted until the update interval of Maven_Central_Repo has elapsed or updates are forced -> [Help 1]
Based on these error messages, what is an startingpoint I should take a look for finding what is going wrong?
You can force Maven to update snapshots with the -U flag.
As far as what is going wrong, you can always check out the actual Maven website with your browser and see if the dependency actually exists.
http://search.maven.org/
If the dependency is not hosted in Maven central, then it seems it is a local dependency that you have to install in your local cache (run mvn clean install from that project).

Resources