I have a maven projects let's call it A which has dependency on two maven projects B, C. Both B and C has a file in resources with same name let say x.xml. I want to exclude this x.xml from B(I don't want to write exclude it from B's jar in M2) jar when building A's War. means it should be present in B's jar but when this jar is copied to A's war should not available. Is it possible?
Delete file from dependency jar using truezip-maven-plugin for example
<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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With