This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes How do I eliminate certain files from my Maven WAR final build? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How do I eliminate certain files from my Maven WAR final build?" Watch "How do I eliminate certain files from my Maven WAR final build?" New topic
Author

How do I eliminate certain files from my Maven WAR final build?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm using Maven 3.0.4. I have some environment specific properties files (e.g. dev_hibernate.cfg.xml), all of which located in my src/main/resources directory. When building my war, I would like these environment specific files removed and so I have this in my pom.xml file …



However, when I run "mvn clean package" the .xml and .properties files are still appearing in my WAR's WEB-INF/classes directory. Can anyone tell what is wrong with the expression above or if there is a better way to do this?

Thanks, - Dave
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30361
    
150

Can you include the <artifactId> for that plugin to make the example runnable on another machine?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
I edited my question to include the artifactId.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

Why are you copying the files again after deleting them???


JBoss In Action
James Boswell
Bartender

Joined: Nov 09, 2011
Posts: 1012
    
    5

I'm going to take a guess that the WAR file has been created during the package phase before your ant tasks are run. Perhaps try running your ant tasks in the prepare-package phase.
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Winner! Thanks, -

ps - Based on the profile used, I'm copying the files from my src/main/resources directory to the WEB-INF/classes directory. However, I don't want to include the other properties files for profiles that aren't used.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I eliminate certain files from my Maven WAR final build?