I'm trying to use the maven dependency plugin to get an artifact in a specific version range. I need to do this on the command line (or in a script)
Here is what i tried:
mvn dependency:get -Dartifact="junit:junit:[4.0,4.11)"
However, the range is apparently not recognized as such. Maven tries and fails to download an artifact with the literal version of [4.0.0,4.11.0).
I guess i am using the wrong syntax and/or are not escaping correctly.
How can i get maven to get the artifact with the highest version fitting the specified version range?
Error message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:get (default-cli) on project standalone-pom: Couldn't download artifact: Missing:
[ERROR] ----------
[ERROR] 1) junit:junit:jar:[4.0,4.11)
Version ranges are not supported for this goal:
https://issues.apache.org/jira/browse/MDEP-88
I get:
Failed to retrieve POM for junit:junit:jar:[4.0,4.11): Could not transfer artifact junit:junit:pom:[4.0,4.11) from/to central (https://repo.maven.apache.org/maven2): Illegal character in path at index 49: https://repo.maven.apache.org/maven2/junit/junit/[4.0,4.11)/junit-[4.0,4.11).pom
So the range is not parsed.
Not sure what's an alternative that does the exact same thing :/
the versions plugin allows to resolve ranges http://www.mojohaus.org/versions-maven-plugin/resolve-ranges-mojo.html but only within a pom.xml - one would need to create a fake pom.xml - use this plugin to resolve the version and then get that out of the created pom - there is hopefully a better way...