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 XML files are not packaged in war 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 "XML files are not packaged in war" Watch "XML files are not packaged in war" New topic
Author

XML files are not packaged in war

John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Hello:

I have a project in which XML configuration files are found together with java files in various packages, just like you would if you were using Hibernate or Struts 2.

When I package my project into a war file using mvn package or mvn install, the resulting war does not contain my configuration files. Why not? How can I tell Maven to transfer these files to the corresponding package in WEB-INF\classes?

Thanks
Eric
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

Try placing the files into src/main/resources. They should then be placed into WEB-INF/classes.


JBoss In Action
John Eric Hamacher
Ranch Hand

Joined: Apr 25, 2007
Posts: 230
Thanks, I have found if I recreate my package structure in resources, these configuration files will merge with my class files in WEB-INF/classes.

Thanks again

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: XML files are not packaged in war