I have a maven3 webapp (war) project that has 2 dependencies. One is a jar (ehcache) and the other a war dependency (a 3rd party lib that I have no control over).
The 3rd party war dependency has a dependency on much earlier version of ehcache which is clashing with the later version I need to use.
The following steps occur during a package of my app.
No matter what I do, the war always includes the earlier version of ehcache. I've even tried writing an ant script which I execute via maven-antrun-plugin that removes the .jar file from the target directory. However, this always gets done before the .war dependency is overlaid.
Does anyone know how I can exclude/remove the earlier version of ehcache?
You'll probably need to exclude the ehcache jar by filename from your overlay. If you aren't already declaring an explicit overlay for your dependent war, you'll have to do that too in the war plugin configuration:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<overlays>
<overlay>
<groupId>your.thirdparty.war.groupId</groupId>
<artifactId>your.thirdparty.war.artifactId</artifactId>
<excludes>
<exclude>WEB-INF/lib/ehcache*.jar</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
</plugins>
</build>
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