dependencies - maven dependency range does not work as expected -
maven 2.2.1 claims support version ranges (see e.g. http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-project-dependencies.html#pom-relationships-sect-version-ranges)
i tried brandnew maven installation following pom:
<project> <modelversion>4.0.0</modelversion> <artifactid>rangetest</artifactid> <groupid>my.group</groupid> <version>1.0</version> <packaging>jar</packaging> <description>test project containing 1 dependency, only</description> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.8</version> <scope>test</scope> </dependency> </dependencies> </project>
the dependency should resolve junit 4.8.2, right? instead, version 4.8 resolved:
c:\users>mvn dependency:tree [info] scanning projects... [info] searching repository plugin prefix: 'dependency'. [info] ------------------------------------------------------------------------ [info] building unnamed - my.group:rangetest:jar:1.0 [info] task-segment: [dependency:tree] [info] ------------------------------------------------------------------------ [info] [dependency:tree {execution: default-cli}] [info] my.group:rangetest:jar:1.0 [info] \- junit:junit:jar:4.8:test [info] ------------------------------------------------------------------------ [info] build successful [info] ------------------------------------------------------------------------ [info] total time: 2 seconds [info] finished at: thu oct 07 14:30:40 cest 2010 [info] final memory: 9m/23m [info] ------------------------------------------------------------------------
you might think it's issue junit, 4.8 existing version, it's not. in projects, have versions deployed 1.0.0 1.0.15 (no version 1.0!), mvn dependency:tree
complains missing artifact of version 1.0.
if want use version ranges, specify version range others pointed out. currently, you're not.
but real advice not use version ranges @ all, version ranges bad idea build reproducibility , last thing want build starts fail because of unknown reason. don't, bad practice (which why version ranges aren't documented anymore).
Comments
Post a Comment