문제

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 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top