从依赖jar中排除资源

gaj*_*mar 7 maven-2 maven-3 maven

我有一个maven项目让我们称它为A依赖于两个maven项目B,C .B和C都有一个同名资源的文件,比如说x.xml.我想在构建A的战争时从B中排除这个x.xml(我不想把它从M2的B罐中排除).意味着它应该出现在B的罐子里但是当这个罐子被复制到A的战争时应该不可用.可能吗?

小智 5

例如,使用truezip-maven-plugin从依赖jar中删除文件

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>1.1</version>
<executions>
    <execution>
        <id>remove-a-file-in-sub-archive</id>
        <goals>
            <goal>remove</goal>
        </goals>
        <phase>package</phase>
        <configuration>
            <fileset>
                <directory>target/mywar-webapp.war/WEB-INF/lib/dependency.jar/dirName/</directory>
                <includes>
                    <include>fileName.xml</include>
                </includes>
            </fileset>
        </configuration>
    </execution>
</executions>
Run Code Online (Sandbox Code Playgroud)