Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Marcelo Tataje
Ranch Hand
Posts: 64
Java Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 64
Java Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic