This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply 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
Ranch Hand

Joined: Nov 09, 2011
Posts: 657
    
    2

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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Problem excluding *.jars in war build using maven(pom.xml)
 
Similar Threads
GWT source jar inclusion for serverside code... all the spring jars?!
Maven Tomcat plugin precompile JSPs problem
problem with jaxws
Problem in Struts : Error 404 : servlet action as unavailable
Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV