2016-09-01 41 views
5

我有一個漂亮的BOM,其dependencyManagement部分有很多依賴關係,我想創建另一個BOM,導入所有依賴關係,除了一個。我試過這樣做:進口依賴管理排除

... in my dependencyManagement section 
<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-dependencies</artifactId> 
    <version>${spring-boot-version}</version> 
    <type>pom</type> 
    <scope>import</scope> 

    <exclusions> 
     <exclusion> 
     <groupId>com.google.code.gson</groupId> 
     <artifactId>gson</artifactId> 
     </exclusion> 
    </exclusions> 
</dependency> 
... 

POM在形式上是正確的,一切都編譯完成。 但排除是簡單地忽略。我錯過了什麼?這種方法是否正確?

我正在使用Maven 3+。

+0

您可能需要提供整體的pom.xml,在至少DependencyManagement和依賴部分 – alexbt

+0

此外,輸入這個「 mvn dependency:tree -Dverbose -Dincludes = com.google.code.gson:gson「向我們展示依賴關係實際來自 – alexbt

+2

的位置[Maven 3.4.0 this will be supported](https://issues.apache。 org/jira/browse/MNG-5600),但目前還不行。 – khmarbaise

回答

1

排除在進口將無法正常工作,請嘗試從依賴關係的實際用戶中排除