在Maven中,如何从特定的依赖关系排除所有的传递依赖关系? [英] In Maven, how can I exclude all transitive dependencies from a particular dependency?

查看:1830
本文介绍了在Maven中,如何从特定的依赖关系排除所有的传递依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从一个依赖关系中排除所有的传递性依赖关系。在某些地方,我看到它建议使用通配符

 < dependency> 
< groupId> myParentPackage< / groupId>
< artifactId> myParentProject< / artifactId>
< version> 1.00.000< / version>
<排除>
< exclude>
< groupId> *< / groupId>
< artifactId> *< / artifactId>
< / exclusion>
< / exclusions>
< / dependency>

当我这样做时,我会发出警告:



myParentPackage中的

 'dependencies.dependency.exclusions.exclusion.groupId':值为'*'的myParentProject:jar与有效的id模式不匹配。 @行146,第30列

声明本身是成功的,但是在传递依赖关系在我的建立。



我还发现一个旧功能请求,请求这个功能



所以现在我不知道这是不推荐的功能,我不应该使用,如果警告错了,或功能还没有完全实现(我正在使用Maven 3.0.4)...有没有人知道更多这个?

解决方案

p>这是Maven 3.2.1中的支持功能 - 请参阅传播依赖关系不包括部分发行说明


I want to exclude all transitive dependencies from one dependency. In some places I've seen it suggested to use a wildcard for that

<dependency>
  <groupId>myParentPackage</groupId>
  <artifactId>myParentProject</artifactId>
  <version>1.00.000</version>            
  <exclusions>
    <exclusion>
        <groupId>*</groupId>
        <artifactId>*</artifactId>
    </exclusion>
  </exclusions>
</dependency>

When I do that I get a warning:

'dependencies.dependency.exclusions.exclusion.groupId' for myParentPackage:myParentProject:jar with value '*' does not match a valid id pattern. @ line 146, column 30

The declaration itself is successful though: The transitive dependencies really are ignored in my build.

I've also found a old feature request that does request exactly this feature

So now I don't know if this is a deprecated feature that I shouldn't use, if the warning's wrong, or of the feature hasn't been completely implemented yet (I'm using Maven 3.0.4) ...Does anybody know more about this?

解决方案

This is a supported feature in Maven 3.2.1 - see 'Transitive dependency excludes' section in the release notes.

这篇关于在Maven中,如何从特定的依赖关系排除所有的传递依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆