Question

When I try to build my Maven project in Eclipse, I'm getting this build failure message:

[INFO] Checking for transitive/resolved version mismatches.
[INFO] com.company.etc:artifact-name:
[INFO]     required: 1.5
[INFO]     resolved: 1.3

My POM file is requesting version 1.5 of this artifact, so that part is correct. But on the repository listed, versions 1.3, 1.4, and 1.5 are all available, with the correct maven-metadata.xml file in the root directory as well. Simply changing my POM file requirements to the older version is not an option, since I need the features in the newest version of the artifact.

I'm really stumped here. Is there anything I'm overlooking that might cause Maven to resolve a lower version number than what is actually available on the repo server?

Was it helpful?

Solution

There are two possible solutions that I found for this issue:

The first one is to specify an exact version requirement, or "hard requirement" for a specific version of a dependency, as shown below:

<version>[1.5]</version>

instead of:

<version>1.5</version>

The second one is to use the mvn dependency:tree Maven command to see exactly what dependencies are being pulled in, and in what hierarchy. In my case, this solved my problem when I noticed that one dependency was actually pulling in an older version of another dependency, as a sub-dependency. Despite the fact that the sub-dependency was specified on its own elsewhere in the POM, Maven used the older version that was pulled in as a sub-dependency. Sounds confusing I know, but either way, mvn dependency:tree should show if a dependency is being pulled in unknowingly, or at an unspecified version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top