【问题标题】:Maven exclusion jar is still part of war fileMaven 排除 jar 仍然是战争文件的一部分
【发布时间】:2013-05-28 16:24:07
【问题描述】:

我正在使用 Maven 3.0.5,并且我在 pom.xml 中有以下内容

          <dependency>
            <groupId>antlr</groupId>
            <artifactId>antlr</artifactId>
            <version>2.7.7</version>
            <scope>runtime</scope>
            <exclusions>
                <exclusion>
                    <groupId>xerces</groupId>
                    <artifactId>xercesImpl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>janino</groupId>
                    <artifactId>janino</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

当我使用mvn install 构建战争时,我可以看到在战争文件中xml-apis-1.0.b2.jar 也包括在内,尽管我已将xml-apis 放在排除列表中。

为什么排除中提到的 artifactId 是 war 文件的一部分?

如何确保xml-apis-1.0.b2.jar 不是文件的一部分?

任何帮助都是非常值得赞赏的。

【问题讨论】:

  • 它是否可能通过其他依赖项包含在内?
  • @Thilo 除了逐个注释掉之外,找出导致问题的其他依赖项的最佳方法是什么?
  • 如果您使用的是 Eclipse,您可以查看依赖关系树(POM 编辑器上的选项卡)。
  • @Thilo 我已按规定添加了xml-apisxml-apis 来自休眠库。例如。 hibernate-coreantlrantlrxml-apis

标签: maven maven-3 war pom.xml


【解决方案1】:

查看maven repo中的maven依赖描述,我没有看到任何antlr的传递依赖。

因此,这意味着检索到的 xml-apis 依赖项来自您项目中的其他一些依赖项。请检查是否是这种情况。

【讨论】:

  • Shinchan 除了逐个注释掉之外,找出导致问题的其他依赖项的最佳方法是什么?
  • 检查this是否有帮助。
  • Shinchan 您的上一条评论确实解决了我的问题,我已按规定添加了xml-apisxml-apis 来自休眠库。例如。 hibernate-coreantlrantlrxml-apis。感谢您提供信息。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多