我的项目依赖于org.apache.pig:pig
但我不想要org.mortbay.jetty:jetty
and的传递依赖org.mortbay.jetty:servlet-api
。我添加了这两个工件,<excludes>
但这似乎不起作用:
mvn dependency:tree -Dincludes=org.mortbay.jetty:servlet-api
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - myGroupp:myArtifact:jar:1.0-SNAPSHOT
[INFO] task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree {execution: default-cli}]
[INFO] myGroupp:myArtifact:jar:1.0-SNAPSHOT
[INFO] \- org.apache.pig:pig:jar:0.10.0:compile
[INFO] \- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:compile
简单展示 pom.xml
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>myGroupp</groupId>
<artifactId>myArtifact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.apache.pig</groupId>
<artifactId>pig</artifactId>
<version>0.10.0</version>
<exclusions>
<exclusion>
<artifactId>org.mortbay.jetty</artifactId>
<groupId>jetty</groupId>
</exclusion>
<exclusion>
<artifactId>org.mortbay.jetty</artifactId>
<groupId>servlet-api</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
我试过这个:mvn --version
- Apache Maven 2.2.1 (rdebian-8)
- 阿帕奇 Maven 3.0.4 (r1232337; 2012-01-17 00:44:56-0800)
有人可以帮我排除这个吗?