2017-04-12 64 views
0

我添加了Maven依赖项,其中类型为test-jar,作用域为test。我想从中删除传递依赖项(因为在Nexus prod repo中,这个依赖项缺失导致Jenkins生成失败)。我已经添加了一个排除标签,但依然不会被删除,即詹金斯构建仍然失败并抱怨这种依赖性。任何线索为什么?从Maven pom中排除传递依赖项

<dependency> 
     <groupId>com.xxx</groupId> 
     <artifactId>xxx</artifactId> 
     <type>test-jar</type> 
     <version>${xxx.version}</version> 
     <scope>test</scope> 
     <exclusions> 
      <exclusion> 
       <artifactId>jamon</artifactId> 
       <groupId>com.jamonapi</groupId> 
       <!-- <scope>compile</scope> --> 
      </exclusion> 
     </exclusions> 
    </dependency> 
+0

你是什么意思:'但依赖不被移除? – khmarbaise

+0

请提供您POM的相关部件。 –

+0

也许其他依赖项通过传递性带来了这种依赖性。没有pom文件就无法告诉更多。 –

回答

3

使用命令mvn dependency:tree -Dverbose -Dincludes=<artifact_name>找出传递依赖性细节,然后你可以排除这个。