2017-02-26 8 views
0

私はMavenの経験があまりありません(以下のシナリオがわかりやすい場合は事前にお詫び申し上げます)。 pom.xmlで、私は春バージョン指定:Maven依存関係ツリー - Springの依存関係のいくつかは古いバージョンを使用しています

<properties> 
... 
    <spring.version>4.3.6.RELEASE</spring.version> 
</properties> 

をしてから、私はすべての春の依存関係のためにそれを使用します。

... 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-aop</artifactId> 
     <version>${spring.version}</version> 
    </dependency> 
... 

しかし、私は実行します。mvn dependency:tree、私はいくつかの依存関係(ことがわかります例:spring-core)古いバージョン番号を使用します。これを説明してください。

Tracking admin$ mvn dependency:tree 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Tracking 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-dependency-plugin:3.0.0:tree (default-cli) @ Tracking --- 
[INFO] com.mycompany:Tracking:war:1.0-SNAPSHOT 
[INFO] +- javax.persistence:persistence-api:jar:1.0.2:compile 
[INFO] +- javax.validation:validation-api:jar:1.1.0.Final:compile 
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:provided 
[INFO] +- com.sun.jersey:jersey-server:jar:1.2:compile 
[INFO] | +- com.sun.jersey:jersey-core:jar:1.2:compile 
[INFO] | | \- javax.ws.rs:jsr311-api:jar:1.1.1:compile 
[INFO] | \- asm:asm:jar:3.1:compile 
[INFO] +- com.sun.jersey.contribs:jersey-spring:jar:1.17:compile 
[INFO] | \- com.sun.jersey:jersey-servlet:jar:1.17:compile 
[INFO] +- org.springframework:spring-aop:jar:3.0.0.RC3:compile 
[INFO] | +- aopalliance:aopalliance:jar:1.0:compile 
[INFO] | \- org.springframework:spring-asm:jar:3.0.0.RC3:compile 
[INFO] +- org.springframework:spring-aspects:jar:4.3.6.RELEASE:compile 
[INFO] | \- org.aspectj:aspectjweaver:jar:1.8.9:compile 
[INFO] +- org.springframework:spring-beans:jar:3.0.0.RC3:compile 
[INFO] +- org.springframework:spring-context:jar:3.0.0.RC3:compile 
[INFO] +- org.springframework:spring-context-support:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-core:jar:3.0.0.RC3:compile 
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile 
[INFO] +- org.springframework:spring-expression:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-instrument:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-instrument-tomcat:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-jdbc:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-jms:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-messaging:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-orm:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-oxm:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-test:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-tx:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-web:jar:3.0.0.RC3:compile 
[INFO] +- org.springframework:spring-webmvc:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-webmvc-portlet:jar:4.3.6.RELEASE:compile 
[INFO] +- org.springframework:spring-websocket:jar:4.3.6.RELEASE:compile 
[INFO] +- javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:jar:1.2.1:compile 
[INFO] +- mysql:mysql-connector-java:jar:5.1.6:compile 
[INFO] +- xerces:xercesImpl:jar:2.11.0:compile 
[INFO] +- cglib:cglib:jar:3.2.4:compile 
[INFO] | +- org.ow2.asm:asm:jar:5.1:compile 
[INFO] | \- org.apache.ant:ant:jar:1.9.6:compile 
[INFO] |  \- org.apache.ant:ant-launcher:jar:1.9.6:compile 
[INFO] +- org.apache.commons:commons-lang3:jar:3.5:compile 
[INFO] +- org.liquibase:liquibase-maven-plugin:jar:3.0.4:compile 
[INFO] | +- org.apache.maven:maven-plugin-api:jar:2.0:compile 
[INFO] | +- org.apache.maven:maven-project:jar:2.0:compile 
[INFO] | | +- org.apache.maven:maven-profile:jar:2.0:compile 
[INFO] | | +- org.apache.maven:maven-model:jar:2.0:compile 
[INFO] | | +- org.apache.maven:maven-artifact-manager:jar:2.0:compile 
[INFO] | | | +- org.apache.maven:maven-repository-metadata:jar:2.0:compile 
[INFO] | | | \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-alpha-5:compile 
[INFO] | | +- org.codehaus.plexus:plexus-utils:jar:1.0.4:compile 
[INFO] | | +- org.apache.maven:maven-artifact:jar:2.0:compile 
[INFO] | | \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-8:compile 
[INFO] | |  +- junit:junit:jar:3.8.1:compile 
[INFO] | |  \- classworlds:classworlds:jar:1.1-alpha-2:compile 
[INFO] | \- org.liquibase:liquibase-core:jar:3.0.4:compile 
[INFO] +- org.yaml:snakeyaml:jar:1.18:compile 
[INFO] \- xml-apis:xml-apis:jar:1.4.01:compile 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 7.200 s 
[INFO] Finished at: 2017-02-26T18:02:17+02:00 
[INFO] Final Memory: 17M/220M 
[INFO] ------------------------------------------------------------------------ 
Tracking admin$ 
+0

あなたのpom.xmlを共有してもらえますか? (親のポームが存在する場合でも、それも有用かもしれません) – Adonis

+0

こんにちは@Asettouf ...私は問題を発見したと思う:http://stackoverflow.com/questions/10952603/maven-downloads-spring-aop- 3-0-0-rc3の代わりに3-1-1-最終。どうやら、私はRestful Web Servicesを作成したときに、Jersey Importを使用したJavaファイルを生成しました。私がMavenのJersey依存関係をコメントすると、Spring Coreが正しいバージョン番号を使用していることがわかります。どうもありがとう ! –

+0

[Mavenは3.1.1.Finalの代わりにSpring-AOP 3.0.0.RC3をダウンロードできます](http://stackoverflow.com/questions/10952603/maven-downloads-spring-aop-3-0-0- rc3-instead-of-3-1-1-final) –

答えて

0

あなたが${spring.version}に一致するバージョンの成果物を使用したい場合は、手動でコアの依存関係を提供する必要があります。いくつかのSpring依存性は、古いバージョンの成果物を使用します。

他の依存関係から特定の依存関係を使いたくないということをMavenに厳密に言うためにここで使うことができる依存関係除外も有用なことです。除外の

例:

<dependencies> 
    <dependency> 
     <groupId>sample.spring</groupId> 
     <artifactId>spring-something</artifactId> 
     <version>${spring.version}</version> 
     <exclusions> 
     <exclusion> 
      <groupId>sample.spring</groupId> <!-- exclude spring-other from spring-something --> 
      <artifactId>spring-other</artifactId> 
     </exclusion> 
     </exclusions> 
    </dependency> 
</dependencies> 
関連する問題