开发者

Multiple identical jar files in an ear file

I have produced an ear file with a war file inside but the ear file contains jar files which are already in the lib folder of the war file. How can I remove the duplicate jar files and where should those jar files be? In the war file's lib folder or outside the war file? (I am开发者_如何学Python using maven ear plugin and maven war plugin in my project).


I finally figured out a way to do this by producing skinny war files inside an ear file. I was inspired by the maven-war-plugin example from here skinny-wars

Followed the instructions of the example, I moved all the jar files out of the war module and put it into a lib folder within ear file.

So the final ear file structure will be:

  ear-app
   -- lib (all the jar files will be here)
   -- webModule1
      -- lib (empty)
   -- webModule2
      -- lib (empty)
   -- ejbModule


If you have jars that are used by both, the EJB archive and the WEB archive, then you can do the following:

  1. keep all the common jars at the root of the .ear
  2. use the Class-Path attribute of the manifest.mf in the ejb and web archives to refer to these jar files. Remember that the location of the jars will be relative to the root of the ear file.

Even if you don't have an EJB jar, the above steps will work.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜