Search code examples
javajakarta-eemavenmaven-ear-plugin

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 using maven ear plugin and maven war plugin in my project).


Solution

  • 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