2017-07-07 17 views
0

は私のポンポンです:春の雲探偵+春ブーツ1.4.0推移依存関係の問題

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>spring-boot-test</groupId> 
    <artifactId>spring-boot-test</artifactId> 
    <version>1.0-SNAPSHOT</version> 

    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.4.0.RELEASE</version> 
     <relativePath/> 
    </parent> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <start-class>com.igor.Application</start-class> 
     <spring-cloud-sleuth.version>1.0.4.RELEASE</spring-cloud-sleuth.version> 
    </properties> 

    <dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>org.springframework.cloud</groupId> 
       <artifactId>spring-cloud-sleuth</artifactId> 
       <version>${spring-cloud-sleuth.version}</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 

    <dependencies> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-web</artifactId> 
     </dependency> 

     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-test</artifactId> 
      <scope>test</scope> 
     </dependency> 

    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
     </plugins> 
    </build> 

</project> 

、ここでは、私の依存関係ツリーです:

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building spring-boot-test 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ spring-boot-test --- 
[INFO] spring-boot-test:spring-boot-test:jar:1.0-SNAPSHOT 
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.4.0.RELEASE:compile 
[INFO] | +- org.springframework.boot:spring-boot-starter:jar:1.4.0.RELEASE:compile 
[INFO] | | +- org.springframework.boot:spring-boot:jar:1.4.0.RELEASE:compile 
[INFO] | | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.4.0.RELEASE:compile 
[INFO] | | +- org.springframework.boot:spring-boot-starter-logging:jar:1.4.0.RELEASE:compile 
[INFO] | | | +- ch.qos.logback:logback-classic:jar:1.1.7:compile 
[INFO] | | | | \- ch.qos.logback:logback-core:jar:1.1.7:compile 
[INFO] | | | +- org.slf4j:jcl-over-slf4j:jar:1.7.21:compile 
[INFO] | | | +- org.slf4j:jul-to-slf4j:jar:1.7.21:compile 
[INFO] | | | \- org.slf4j:log4j-over-slf4j:jar:1.7.21:compile 
[INFO] | | \- org.yaml:snakeyaml:jar:1.17:runtime 
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.4.0.RELEASE:compile 
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.4:compile 
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.4:compile 
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.4:compile 
[INFO] | +- org.hibernate:hibernate-validator:jar:5.2.4.Final:compile 
[INFO] | | +- javax.validation:validation-api:jar:1.1.0.Final:compile 
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile 
[INFO] | | \- com.fasterxml:classmate:jar:1.3.1:compile 
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.1:compile 
[INFO] | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.1:compile 
[INFO] | | \- com.fasterxml.jackson.core:jackson-core:jar:2.8.1:compile 
[INFO] | +- org.springframework:spring-web:jar:4.2.6.RELEASE:compile 
[INFO] | | +- org.springframework:spring-aop:jar:4.2.6.RELEASE:compile 
[INFO] | | | \- aopalliance:aopalliance:jar:1.0:compile 
[INFO] | | +- org.springframework:spring-beans:jar:4.2.6.RELEASE:compile 
[INFO] | | \- org.springframework:spring-context:jar:4.2.6.RELEASE:compile 
[INFO] | \- org.springframework:spring-webmvc:jar:4.2.6.RELEASE:compile 
[INFO] |  \- org.springframework:spring-expression:jar:4.2.6.RELEASE:compile 
[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:1.4.0.RELEASE:test 
[INFO] +- org.springframework.boot:spring-boot-test:jar:1.4.0.RELEASE:test 
[INFO] +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.4.0.RELEASE:test 
[INFO] +- com.jayway.jsonpath:json-path:jar:2.2.0:test 
[INFO] | +- net.minidev:json-smart:jar:2.2.1:test 
[INFO] | | \- net.minidev:accessors-smart:jar:1.1:test 
[INFO] | |  \- org.ow2.asm:asm:jar:5.0.3:test 
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.21:compile 
[INFO] +- junit:junit:jar:4.12:test 
[INFO] +- org.assertj:assertj-core:jar:2.5.0:test 
[INFO] +- org.mockito:mockito-core:jar:1.10.19:test 
[INFO] | \- org.objenesis:objenesis:jar:2.1:test 
[INFO] +- org.hamcrest:hamcrest-core:jar:1.3:test 
[INFO] +- org.hamcrest:hamcrest-library:jar:1.3:test 
[INFO] +- org.skyscreamer:jsonassert:jar:1.3.0:test 
[INFO] | \- org.json:json:jar:20140107:test 
[INFO] +- org.springframework:spring-core:jar:4.3.2.RELEASE:compile 
[INFO] \- org.springframework:spring-test:jar:4.2.6.RELEASE:test 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1.126 s 
[INFO] Finished at: 2017-07-07T20:25:23+03:00 
[INFO] Final Memory: 21M/437M 
[INFO] ------------------------------------------------------------------------ 

spring-boot-sleuthのように見える依存関係がオーバーライドされているため、Spring Boot 1.4ではspring 4.3.2.RELEASEを使用しています。 私はそれを必要としません、どのようにこの動作を避けるために?

+0

https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html –

+0

okしかし、これは本当にエラーが起こりやすいです、なぜ私はスプリングコア4.3.2の代わりに4.2.6を持っているのか把握しました – idmitriev

+0

"これは本当にエラーが起こりやすい" - これは何ですか? Maven依存関係管理、またはあなたのコード? –

答えて

2

Mavenでは依存関係を除外できます。しかし、リリーストレインのBOMを使用して、最もよくマッチする依存関係が選択されるようにしてください。

+0

私はBOMとしてSpring Bootを使用していますが、親pomを使用しています – idmitriev

+1

ええ、クラウドBOM - http://projects.spring.io/spring-cloud/ –

+0

素晴らしい、それは、ありがとう、動作します – idmitriev