“忽略冲突”这是Maven的2.2.1产生依赖树 mvn -o dependency:tree -Dverbose -Dincludes=log4j
解释在Maven 2依赖树
[INFO] [dependency:tree {execution: default-cli}]
[INFO] com.openboxes.renderingservice:common:jar:1.0
[INFO] +- org.springframework:spring:jar:2.0.4:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1:compile
[INFO] | \- log4j:log4j:jar:1.2.12:compile
[INFO] \- it.mycompany.portal:server:jar:1.5-SNAPSHOT:compile
[INFO] \- org.slf4j:slf4j-log4j12:jar:1.1.0:compile
[INFO] \- (log4j:log4j:jar:1.2.13:compile - omitted for conflict with 1.2.12)
正如你所看到的log4j v1.2.12优于v1.2.13。我知道“Maven解决了与最近赢策略的版本冲突”(见http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html),但是这两个依赖关系似乎处于相同的距离(两个嵌套层次,我错了吗?),所以我期望最最近使用了一个。
有人可以解释这个结果吗?
是的,log4j没有在这个POM中显式声明(我认为它应该是),但我想更好地理解Maven的工作方式。
THX
这是值得怀疑的,但至少是确定性的。 – TWiStErRob
https://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html – daemon54