Let us assume that we have an EAR which is dependent on Struts-x version.
Ear dependent on Struts
java 1 dependent on Struts
java 2
web dependent on Struts
Now when we build, our EAR contains struts-x.jar and all the other
transitive dependencies of struts. Since our classloader policy for EAR is
"application", we don't want struts-x.jar and transitive dependencies in
web/web-inf/lib. To avoid this, in the web project pom.xml we defined
<dependency>
<groupId>struts</groupId>
<artifactId>struts</artifactId>
<version>1.1</version>
<optional>true</optional>
</dependency>
By doing this, I am able to avoid bundling of struts.jar in web-inf/lib
folder in WAR but all the transitive dependent jars are still bundled in the
WAR. Is there a way to avoid this?
-Sanjay