v.k*_*but 2 java dependencies maven
我在我的web项目中使用以下库:
当我组装war时,将额外的commons-logging-1.0.4.jar库复制到WEB-INF/lib.我认为这是因为我的一个库依赖于commons-logging-1.0.4.jar.我想排除commons-logging-1.0.4.jar(由于jcl-over-slf4j-1.6.0.jar已经在这里)使用
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
<exclusions>
...
</exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud)
为此,我需要找到我的pom中的库取决于commons-logging.
您可以使用mvn dependency:tree命令找到依赖关系树.
从树中,您可以排除工件.
示例输出:
[INFO] | +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.20.0:test
[INFO] | | +- org.seleniumhq.selenium:selenium-api:jar:2.20.0:test
[INFO] | | +- net.sourceforge.htmlunit:htmlunit:jar:2.9:test
[INFO] | | | +- xalan:xalan:jar:2.7.1:test
[INFO] | | | | \- xalan:serializer:jar:2.7.1:test
[INFO] | | | +- commons-collections:commons-collections:jar:3.2.1:test
[INFO] | | | +- commons-lang:commons-lang:jar:2.6:test
[INFO] | | | +- org.apache.httpcomponents:httpmime:jar:4.1.2:test
[INFO] | | | +- commons-codec:commons-codec:jar:1.4:test
[INFO] | | | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.9:test
[INFO] | | | +- xerces:xercesImpl:jar:2.9.1:test
[INFO] | | | | \- xml-apis:xml-apis:jar:1.3.04:test
Run Code Online (Sandbox Code Playgroud)
如果依赖项是可传递的,您可以根据上面的树执行以下操作:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>2.20</version>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.9</version>
<!-- i dont want u -->
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
143 次 |
| 最近记录: |