It's not a secret anymore!*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 5838
    
    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
 
Consider Paul's rocket mass heater.
 
subject: XML files are not packaged in war