Maven版本范围出现意外的依赖性 [英] Maven version range picking up unexpected dependency
问题描述
我正在使用版本范围定义的依赖项:
I'm having a dependency defined with a version range:
<properties>
<tomcat.version>[8.0.33,9.0.0)</tomcat.version>
</properties>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
<scope>provided</scope>
</dependency>
阅读maven版本后,我希望它的类型是"[1.0,2.0)-> 1.0< = x< 2.0".但是dependency:tree
会导致以下已解决的版本:
Reading up on maven versions, I expected it to be of the "[1.0,2.0) -> 1.0 <= x < 2.0" variety. But a dependency:tree
results in the following resolved version:
+-org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.0.M9:提供
+- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.0.M9:provided
我如何告诉Maven使用任何专业 8版本从增量版本33开始?我目前正在使用[8.0.33,8.5.4]
来解决它.
How can I tell Maven to use any Major 8 version starting at incremental version 33? I'm currently working around it by using [8.0.33,8.5.4]
instead.
推荐答案
您可以通过以下命令行检查版本比较在Maven中的结果:
You can check the how version comparsion results in Maven via the folloing command line:
java -jar apache-maven-3.3.9/lib/maven-artifact-3.3.9.jar 9.0.0 9.0.0.M9
结果如下:
Display parameters as parsed by Maven (in canonical form) and comparison result:
1. 9.0.0 == 9
9.0.0 > 9.0.0.M9
2. 9.0.0.M9 == 9.0.0.milestone-9
表明9.0.0
大于9.0.0.M9
...这意味着您得到的结果是正确的.
which shows that 9.0.0
is greater than 9.0.0.M9
...which means the result you got was correct.
这篇关于Maven版本范围出现意外的依赖性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!