【问题标题】:Maven cargo uberwar : how to exclude a dependancyMaven 货物网络战:如何排除依赖项
【发布时间】:2013-10-10 08:29:20
【问题描述】:

我正在尝试使用 Maven cargo uberwar 插件。 我想这样做:

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.2.2</version>
            <extensions>true</extensions>
            <configuration>
                <descriptor>src/assemble/merge.xml</descriptor>
            </configuration>
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>my.first.war</groupId>
        <artifactId>MyFirstWar</artifactId>
        <type>war</type>
        <exclusions> 
            <exclusion> 
                <groupId>javassist</groupId> 
                <artifactId>javassist</artifactId> 
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>my.second.war</groupId>
        <artifactId>MySecondWar</artifactId>
        <type>war</type>
            <exclusions> 
        <exclusions> 
            <exclusion> 
                <groupId>javassist</groupId> 
                <artifactId>javassist</artifactId> 
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

但它不起作用,安装我的 uberwar 后 javassist 仍在我的库中。

我不想在我的两次战争中排除,我想在我的超级战争中排除。 这个方法不行,还有其他的吗?

感谢您的帮助

【问题讨论】:

  • cargo-maven2-plugin 用于功能测试,但不用于重新打包。基于 [docs|(cargo.codehaus.org/Merging+WAR+files) 我假设您错过了更改包装类型&lt;packaging&gt;uberwar&lt;/packaging&gt;。在这种情况下,您不能从 deps 中排除 deps,因为 deps 是 wars 而不仅仅是项目的依赖项。
  • 我的 Pom.xml 的打包类型已经 uberwar 了。我通过在我的 pom 上添加一个 antrun 插件来解决我的问题,该插件在我执行 maven 安装后删除了 jar。但也许有更好的方法来做到这一点......

标签: java eclipse maven merge cargo


【解决方案1】:

对于每场战争,您应该设置为 javassist 提供的范围。就像这样:

<dependency>
    <groupId>javassist</groupId> 
    <artifactId>javassist</artifactId>
    <scope>provided</scope>
</dependency>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-25
    • 1970-01-01
    • 2017-09-14
    • 2012-08-16
    • 1970-01-01
    • 1970-01-01
    • 2015-10-26
    • 2022-11-30
    相关资源
    最近更新 更多