我有一个声明为https://mvnrepository.com/artifact/io.zipkin.reporter2/zipkin-sender-okhttp3/2.7.14的依赖项
<dependency>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-sender-okhttp3</artifactId>
<version>2.7.14</version>
</dependency>
pom中的此依赖项与pom文件的父依赖项声明如下:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>zipkin-reporter</artifactId>
<version>${project.version}</version>
</dependency>
project.groupid等于io.zipkin.reporter2,而project.version等于2.7.14。因此,maven应该导入版本等于2.7.14的依赖项<artifactId>zipkin-reporter</artifactId>
。 但会导入2.2.0版。我没有在其他任何地方声明此依赖,其他依赖也没有将此依赖视为可传递的。我尝试重新安装Maven,从git重新克隆项目,使缓存无效并重新启动IDEA,删除.m2文件夹-没有任何效果。
奇怪的是,我有另一个项目正在使用完全相同的依赖项(<artifactId>zipkin-sender-okhttp3</artifactId>
),并且所有版本都是按应有的顺序排列的。
有什么想法可以解决吗?
编辑:mvn依赖项:树输出(我编辑了敏感信息):`
mvn dependency:tree -Dverbose -Dincludes=io.zipkin.reporter2:zipkin-reporter
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.***.rnd.dep:***-deployment:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: commons-io:commons-io:jar -> duplicate declaration of version 2.6 @ com.***.rnd.dep:***-deployment:[unknown-version], C:\Users\nimi0218\Des
ktop\Projects\CJM(DEP)\***\***-deployment\pom.xml, line 70, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Notification Service [pom]
[INFO] ***-api [jar]
[INFO] ***-impl [jar]
[INFO] ***-sms [jar]
[INFO] ***-email [jar]
[INFO] ***-push [jar]
[INFO] ***-rest [jar]
[INFO] ***-mq [jar]
[INFO] ***-deployment [jar]
[INFO]
[INFO] ------------< com.***.rnd.dep:*** >-------------
[INFO] Building Notification Service 0.0.1-SNAPSHOT [1/9]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ *** ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.***.rnd.dep:***:pom:0.0.1-SNAPSHOT
[INFO] \- io.zipkin.reporter2:zipkin-sender-okhttp3:jar:2.7.14:compile
[INFO] \- io.zipkin.reporter2:zipkin-reporter:jar:2.7.14:compile
[INFO]
[INFO] ----------< com.***.rnd.dep:***-api >-----------
[INFO] Building ***-api 0.0.1-SNAPSHOT [2/9]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ ***-api ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.***.rnd.dep:***-api:jar:0.0.1-SNAPSHOT
[INFO] \- io.zipkin.reporter2:zipkin-sender-okhttp3:jar:2.7.14:compile
[INFO] \- io.zipkin.reporter2:zipkin-reporter:jar:2.7.14:compile
[INFO]
[INFO] ----------< com.***.rnd.dep:***-impl >----------
[INFO] Building ***-impl 0.0.1-SNAPSHOT [3/9]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ ***-impl ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.***.rnd.dep:***-impl:jar:0.0.1-SNAPSHOT
[INFO] \- io.zipkin.reporter2:zipkin-sender-okhttp3:jar:2.7.14:compile
[INFO] \- io.zipkin.reporter2:zipkin-reporter:jar:2.7.14:compile
[INFO]
[INFO] ----------< com.***.rnd.dep:***-sms >-----------
[INFO] Building ***-sms 0.0.1-SNAPSHOT [4/9]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ ***-sms ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.***.rnd.dep:***-sms:jar:0.0.1-SNAPSHOT
[INFO] \- io.zipkin.reporter2:zipkin-sender-okhttp3:jar:2.7.14:compile
[INFO] \- io.zipkin.reporter2:zipkin-reporter:jar:2.7.14:compile
[INFO]
[INFO] ---------< com.***.rnd.dep:***-email >----------
[INFO] Building ***-email 0.0.1-SNAPSHOT [5/9]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ ***-email ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.***.rnd.dep:***-email:jar:0.0.1-SNAPSHOT
[INFO] \- io.zipkin.reporter2:zipkin-sender-okhttp3:jar:2.7.14:compile
[INFO] \- io.zipkin.reporter2:zipkin-reporter:jar:2.7.14:compile
[INFO]
[INFO] ----------< com.***.rnd.dep:***-push >----------
[INFO] Building ***-push 0.0.1-SNAPSHOT [6/9]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ ***-push ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.***.rnd.dep:***-push:jar:0.0.1-SNAPSHOT
[INFO] \- io.zipkin.reporter2:zipkin-sender-okhttp3:jar:2.7.14:compile
[INFO] \- io.zipkin.reporter2:zipkin-reporter:jar:2.7.14:compile
[INFO]
[INFO] ----------< com.***.rnd.dep:***-rest >----------
[INFO] Building ***-rest 0.0.1-SNAPSHOT [7/9]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ ***-rest ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.***.rnd.dep:***-rest:jar:0.0.1-SNAPSHOT
[INFO] \- io.zipkin.reporter2:zipkin-sender-okhttp3:jar:2.7.14:compile
[INFO] \- io.zipkin.reporter2:zipkin-reporter:jar:2.7.14:compile
[INFO]
[INFO] -----------< com.***.rnd.dep:***-mq >-----------
[INFO] Building ***-mq 0.0.1-SNAPSHOT [8/9]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ ***-mq ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.***.rnd.dep:***-mq:jar:0.0.1-SNAPSHOT
[INFO] \- io.zipkin.reporter2:zipkin-sender-okhttp3:jar:2.7.14:compile
[INFO] \- io.zipkin.reporter2:zipkin-reporter:jar:2.7.14:compile
[INFO]
[INFO] -------< com.***.rnd.dep:***-deployment >-------
[INFO] Building ***-deployment 0.0.1-SNAPSHOT [9/9]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ ***-deployment ---
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.***.rnd.dep:***-deployment:jar:0.0.1-SNAPSHOT
[INFO] \- io.zipkin.reporter2:zipkin-sender-okhttp3:jar:2.7.14:compile
[INFO] \- io.zipkin.reporter2:zipkin-reporter:jar:2.2.0:compile (version managed from 2.7.14)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Notification Service 0.0.1-SNAPSHOT:
[INFO]
[INFO] Notification Service ............................... SUCCESS [ 22.484 s]
[INFO] ***-api ........................... SUCCESS [ 1.086 s]
[INFO] ***-impl .......................... SUCCESS [ 1.060 s]
[INFO] ***-sms ........................... SUCCESS [ 0.790 s]
[INFO] ***-email ......................... SUCCESS [ 0.960 s]
[INFO] ***-push .......................... SUCCESS [ 1.112 s]
[INFO] ***-rest .......................... SUCCESS [ 1.327 s]
[INFO] ***-mq ............................ SUCCESS [ 0.827 s]
[INFO] ***-deployment .................... SUCCESS [ 4.317 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 39.287 s
[INFO] Finished at: 2019-03-01T15:37:07+03:00
[INFO] ------------------------------------------------------------------------
` 所有模块的版本应为2.7.7,但一个名为...- deployment的模块的版本为2.2.0。在那里没有明确设置。
答案 0 :(得分:0)
您有
io.zipkin.reporter2:zipkin-reporter:jar:2.2.0:compile (version managed from 2.7.14)
这意味着您的POM或您的父POM中有一个<dependencyManagement>
条目,用于将版本设置为2.2.0
。