Separate same jars in different WAR of a EAR

2019-07-11 02:47发布

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.

2条回答
趁早两清
2楼-- · 2019-07-11 03:08

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)

查看更多
Bombasti
3楼-- · 2019-07-11 03:20

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.

查看更多
登录 后发表回答