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).
Asked
Active
Viewed 2,411 times
3
-
Which EE version are you using? 5 or 6? – javamonkey79 Nov 26 '10 at 03:54
-
I am using Java 1.6 so I guess it is J2EE 6? But what is the difference between the two? – newguy Nov 26 '10 at 04:25
2 Answers
3
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

newguy
- 5,668
- 12
- 55
- 95
0
If you have jars that are used by both, the EJB archive and the WEB archive, then you can do the following:
- keep all the common jars at the root of the .ear
- 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.

Ryan Fernandes
- 8,238
- 7
- 36
- 53
-
Even though I use Class-Path the war file always has a lib folder with jar files in it. How can I remove that? – newguy Nov 29 '10 at 05:00