gpt4 book ai didi

java - 排除的 Artifact 显示在依赖项 :tree 中

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:59:24 26 4
gpt4 key购买 nike

我的项目依赖于 org.apache.pig:pig但我不想要 org.mortbay.jetty:jetty 的传递依赖和 org.mortbay.jetty:servlet-api .我将这两个 Artifact 添加为 <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)
  • Apache Maven 3.0.4 (r1232337; 2012-01-17 00:44:56-0800)

谁能帮我排除这个?

最佳答案

您已调换 artifactId 和 groupId 元素值。

试试这些排除:

<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
</exclusion>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>

关于java - 排除的 Artifact 显示在依赖项 :tree 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14763169/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com