简体   繁体   中英

How to remove jar files from war file when deploying a java web application with jboss

I built my netbeans project and it created a .war file including all the .jar libraries. I need to remove my all libraries from .war file. I tried to untick them from library folder but then the project does not deployed. How can I remove my libraries from the .war file and if I remove them where should I put them correctly. In jboss also there is a folder called lib in standalone folder.Should I put them there? If so how to do it. I am not using maven.

You can try following approach. I haven't worked on Jboss so don't have detail idea about it.

Deploy each logical library (like "OpenJPA" or "Log4J") as a module, including its api and impl jars and any dependency JARs that aren't already provided by other AS7 modules. If there's already a module add a dependency on it rather than adding a JAR to your module. If several different libraries share some common dependencies, split them out into modules and add them as module dependencies in module.xml.

Use jboss-deployment-structure.xml to have your deployment .war / .ear / whatever declare a dependency on the module if it isn't autodetected and autoloaded.

Courtesy @Craig Ringer.

For complete thread go here

If you are using Maven set the dependency scope to the libraries you would like omitted to have scope provided. You can add the dependencies of your WAR to the MANIFEST.MF file or the jboss-deployment-structure.xml file using Maven. If the lirbaries are not JBoss modules by default, eg Orcale JDBC driver, then you will need to create these modules yourself. See the JBoss AS 7 documentation on how to do this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM