Maven:模块之间的依赖关系不同

时间:2015-04-27 14:25:12

标签: java maven dependencies

我有一个奇怪的问题我无法解释:我有三个模块,hadatacollector-fhem-api,hadatacollector-service和hadatacollector-server-standalone。第一个使用gson,这里是mvn依赖的输出:tree:

de.swm.ha:hadatacollector-fhem-api:jar:1.0-SNAPSHOT
+- org.slf4j:slf4j-log4j12:jar:1.7.7:compile
+- org.slf4j:slf4j-api:jar:1.7.7:compile
+- log4j:log4j:jar:1.2.17:compile
\- com.google.code.gson:gson:jar:2.3.1:compile

可以看出,它使用的是gson 2.3.1。第二个模块使用第一个,这里是各自的依赖:

de.swm.ha:hadatacollector-service:jar:1.0-SNAPSHOT
+- de.swm.ha:hadatacollector-model:jar:1.0-SNAPSHOT:compile
|  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
|  \- com.google.guava:guava:jar:18.0:compile
+- de.swm.ha:hadatacollector-persistence:jar:1.0-SNAPSHOT:compile
|  +- org.slf4j:slf4j-log4j12:jar:1.7.7:compile
|  +- org.slf4j:slf4j-api:jar:1.7.7:compile
|  +- log4j:log4j:jar:1.2.17:compile
|  +- org.springframework:spring-context:jar:4.1.4.RELEASE:compile
|  |  +- org.springframework:spring-aop:jar:4.1.4.RELEASE:compile
|  |  |  \- aopalliance:aopalliance:jar:1.0:compile
|  |  +- org.springframework:spring-beans:jar:4.1.4.RELEASE:compile
|  |  \- org.springframework:spring-expression:jar:4.1.4.RELEASE:compile
|  \- org.springframework:spring-tx:jar:4.1.4.RELEASE:compile
+- de.swm.ha:hadatacollector-fhem-api:jar:1.0-SNAPSHOT:compile
|  \- com.google.code.gson:gson:jar:2.3.1:compile
\- org.springframework.boot:spring-boot:jar:1.2.1.RELEASE:compile
   \- org.springframework:spring-core:jar:4.1.4.RELEASE:compile
      \- commons-logging:commons-logging:jar:1.2:compile

这里也使用了gson 2.3.1。但是,第三个模块使用第二个模块,输出现在是:

de.swm.ha:hadatacollector-server-standalone:jar:1.0-SNAPSHOT
+- de.swm.ha:hadatacollector-model:jar:1.0-SNAPSHOT:compile
|  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
|  \- com.google.guava:guava:jar:18.0:compile
+- de.swm.ha:hadatacollector-persistence:jar:1.0-SNAPSHOT:compile
|  +- org.springframework:spring-context:jar:4.1.4.RELEASE:compile
|  |  +- org.springframework:spring-aop:jar:4.1.4.RELEASE:compile
|  |  |  \- aopalliance:aopalliance:jar:1.0:compile
|  |  +- org.springframework:spring-beans:jar:4.1.4.RELEASE:compile
|  |  \- org.springframework:spring-expression:jar:4.1.4.RELEASE:compile
|  \- org.springframework:spring-tx:jar:4.1.4.RELEASE:compile
+- de.swm.ha:hadatacollector-service:jar:1.0-SNAPSHOT:compile
|  +- de.swm.ha:hadatacollector-fhem-api:jar:1.0-SNAPSHOT:compile
|  |  \- com.google.code.gson:gson:jar:2.3:compile
|  \- org.springframework.boot:spring-boot:jar:1.2.1.RELEASE:compile
+- de.swm.ha:hadatacollector-util:jar:1.0-SNAPSHOT:compile
+- org.slf4j:slf4j-log4j12:jar:1.7.7:compile
+- org.slf4j:slf4j-api:jar:1.7.7:compile
+- log4j:log4j:jar:1.2.17:compile
+- org.springframework.boot:spring-boot-starter:jar:1.2.1.RELEASE:compile
|  +- org.springframework:spring-core:jar:4.1.4.RELEASE:compile
|  \- org.yaml:snakeyaml:jar:1.14:runtime
+- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.2.1.RELEASE:compile
|  +- org.springframework.boot:spring-boot-starter-   aop:jar:1.2.1.RELEASE:compile
|  |  +- org.aspectj:aspectjrt:jar:1.8.4:compile
|  |  \- org.aspectj:aspectjweaver:jar:1.8.4:compile
|  +- org.hibernate:hibernate-entitymanager:jar:4.3.7.Final:compile
|  |  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
|  |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
|  |  +- org.hibernate:hibernate-core:jar:4.3.7.Final:compile
|  |  |  +- antlr:antlr:jar:2.7.7:compile
|  |  |  \- org.jboss:jandex:jar:1.1.0.Final:compile
|  |  +- dom4j:dom4j:jar:1.6.1:compile
|  |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
|  |  +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
|  |  \- org.javassist:javassist:jar:3.18.1-GA:compile
|  +- javax.transaction:javax.transaction-api:jar:1.2:compile
|  +- org.springframework:spring-orm:jar:4.1.4.RELEASE:compile
|  +- org.springframework.data:spring-data-jpa:jar:1.7.1.RELEASE:compile
|  |  +- org.springframework.data:spring-data-commons:jar:1.9.1.RELEASE:compile
|  |  \- org.slf4j:jcl-over-slf4j:jar:1.7.8:runtime
|  \- org.springframework:spring-aspects:jar:4.1.4.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-jdbc:jar:1.2.1.RELEASE:compile
|  +- org.springframework:spring-jdbc:jar:4.1.4.RELEASE:compile
|  \- org.apache.tomcat:tomcat-jdbc:jar:8.0.15:compile
|     \- org.apache.tomcat:tomcat-juli:jar:8.0.15:compile
+- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.1.RELEASE:compile
\- mysql:mysql-connector-java:jar:5.1.34:compile

现在使用gson 2.3。我已检查过其他依赖项,也没有使用gson。最后一个模块如何使用与其依赖模块不同的gson版本?

更新:添加了完整的依赖关系树。

0 个答案:

没有答案