File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes Problem excluding *.jars in war build using maven(pom.xml) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Problem excluding *.jars in war build using maven(pom.xml)" Watch "Problem excluding *.jars in war build using maven(pom.xml)" New topic
Author

Problem excluding *.jars in war build using maven(pom.xml)

Marcelo Tataje
Ranch Hand

Joined: Jan 31, 2011
Posts: 64

Hello everybody, I've been working with maven with a multi-module project, I had some problems to achieve my war building but I finally did it. The problem now is the deploying of my war.

The problem is basically that my war is being generated with some extra jars, these "extra" jars causes a conflict with other jars in my tomcat, that's why I want to remove them during the build of my war. For example my war must be like this to run:

ROOT.war/WEB-INF/classes/lib/stax-api.jar
ROOT.war/WEB-INF/classes/lib/webservices-rt.jar
ROOT.war/WEB-INF/classes/lib/junit.jar

But in the war they appeared like this:
ROOT.war/WEB-INF/classes/lib/activation.jar
ROOT.war/WEB-INF/classes/lib/jaxb.jar
ROOT.war/WEB-INF/classes/lib/xerces.jar
ROOT.war/WEB-INF/classes/lib/stream.jar
ROOT.war/WEB-INF/classes/lib/stax-api.jar
ROOT.war/WEB-INF/classes/lib/webservices-rt.jar
ROOT.war/WEB-INF/classes/lib/junit.jar
and a lot of jars more that I don't want because they cause a "NoSuchMethodError" during my deploy in tomcat, I tried the tag "scope: provided" for the dependencies, I also tried "excludes" to exclude the jars but none of them seems to work, the war is always generated with all these jars.

Please I will be very grateful if someone could help me I will be really grateful, thanks in advance for your attention and help.
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

Could you provide more information about the structure of your Maven project? Specifically, where files reside before you run a Maven build.
Marcelo Tataje
Ranch Hand

Joined: Jan 31, 2011
Posts: 64

Sorry for the inconvenients, after look my pom.xml for almost 4 hours I was able to found the error, the problem were these tags:



I removed from my pom and voilá, it worked. Hope the solution runs for the person who needed. Thanks for your attention and time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem excluding *.jars in war build using maven(pom.xml)
 
Similar Threads
problem with jaxws
Maven Tomcat plugin precompile JSPs problem
Problem in Struts : Error 404 : servlet action as unavailable
GWT source jar inclusion for serverside code... all the spring jars?!
Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV