Search code examples
javahibernatemaven-2

Why is maven not packaging my hibernate-mapping file?


I'm using Maven 2 and Hibernate for a Java web app.

I have a Hibernate-mapping file, Domain.hbm.xml in the same source folder with several domain classes.

If I run mvn clean package I find that this file is not copied into the war file in the target folder.

However, if I do only mvn clean and then go to eclipse and select Clean from the Project menu, the file is sent to the appropriate place in the target. I can then do mvn package to sucessfully package a war file that has access to the database.

Is a pom setting for this? What's going on?


Solution

  • Resources other than Java sources you want to end up on the classpath directly (in your case inside /WEB-INF/classes) must go in your src/main/resources directory, not src/main/java.