问题
currently we are facing one problem. We are building a ear which contains multiple war files. In 2 of the WARs contains same jars. Both these wars need these jars during deployment.So Is there any way in ANT I can built it so that these jars will be in one single place and it will not create any problem during the ear deployment.
回答1:
well, you can do it the portable way:
Place the library jars at the root of .ear file.
Example:
library jar -> lib1.jar, lib2.jar
[EAR STRUCTURE]
your.ear
|--yourfirst.war
|--yoursecond.war
|--lib1.jar
|--lib2.jar
Update the MANIFEST.MF files in both the .war files to point to these jars
like so:Class-Path: lib1.jar lib2.jar
(dont forget to add a space and a newline character to the end of the above line if this is the last entry in the manifest)
回答2:
You can put those shared JARs into the EAR's lib
directory. Those will then be available on the classpath for any WARs in that EAR.
来源:https://stackoverflow.com/questions/5337784/separate-same-jars-in-different-war-of-a-ear