开发者

Separate same jars in different WAR of a EAR

开发者 https://www.devze.com 2023-02-17 04:48 出处:网络
currently we are facing one problem. We are building a ear which contains multiple war files开发者_如何学Go. In 2 of the WARs contains same jars. Both these wars need these jars during deployment.So I

currently we are facing one problem. We are building a ear which contains multiple war files开发者_如何学Go. 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.


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)


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号