Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.0.10, 2.1.0
-
Fix Version/s: Issues to be reviewed for 3.x
-
Component/s: Dependencies
-
Labels:None
-
Complexity:Intermediate
-
Number of attachments :
Description
The behaviour is like this:
If I have a pom with a single dependency with a version range like this.
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>[3.0, 3.8.2)</version>
</dependency>
I can access the version range using the resolved dependency artifact.
Set artifacts = project.getDependencyArtifacts(); artifact.getVersionRange();
If the same dependency is picked up transitively from another dependency, for example junit is a trasitive dependency of maven-project:
<dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-project</artifactId> <version>2.0.8</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>[3.0, 3.8.2)</version> </dependency>
Now the VersionRange object is returned, but it only contains the resolved version. For example "3.8.1".
Issue Links
- is related to
-
MVERSIONS-24
Enable resolution of dependency version ranges
-
This also occurs when using dependencies retrieved from project.getDependencies(). In one the first case, dependency.getVersion() returns the range, in the second situation, dependency.getVersion() returns the resolved version.
Also this only happens when the transitive dependency fits in the range of the direct dep. If the transitive dependency is outside the range specified, then the range is available using dependency.getVersion() or artifact.getVersionRange().