Separate same jars in different WAR of a EAR

☆樱花仙子☆ 提交于 2020-01-04 06:44:09

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!