i am using net beans IDE and wild-fly server.I have multiple war and they share common library. i want to package all the libraries in one place so that they don't appear twice in same ear.
Asked
Active
Viewed 1,081 times
-1
-
How are you building this project? Do you use Maven or something similar? – Steve C Aug 02 '17 at 13:36
-
Yes @steve C but i am using Ant and not maven. i tried to add all the libraries in ear > propertie> library> Mylib> all lib jar. and then in manifest.mf file of war Class pat : lib/Mylib/xyz.jar and in application.xmp
lib and its not working ...can you help me? – s.kumar Aug 17 '17 at 12:26
1 Answers
0
You can create a JBoss Module for your jars. (under $JBOSSHOME/modules/org/module/for/dependencies/main) You need to copy the jars into the main folder and create a module.xml like that:
<module xmlns="urn:jboss:module:1.1" name="org.module.for.dependecies">
<resources>
<resource-root path="xy.jar"/>
.
.
.
</resources>
</module>
Then add to your project(s) a deployment-structure.xml (WEB-INF/jboss-deployment-structure.xml to the WAR or META-INF/jboss-deployment-structure.xml to the EAR). And configure like that:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.module.for.dependecies"/>
</dependencies>
</deployment>
</jboss-deployment-structure>

awagenhoffer
- 261
- 1
- 4
- 13
-
Thanks for the answer! i was thinking to add all the libraries under root ear folder using properties > library > add jar or library. Is it a good method? can you help me proceed this way? – s.kumar Aug 02 '17 at 10:26
-
How does your project structure look like? Do you have an ear and in ear many wars? – awagenhoffer Aug 02 '17 at 12:54
-
Yes @awagenoffer i t has an ear and many wars inside ear.although i was trying for 2 war files first. – s.kumar Aug 04 '17 at 05:22
-
check [this](https://stackoverflow.com/a/15230037/6418009) answer. It could be the solution. – awagenhoffer Aug 04 '17 at 05:41
-