Didn't see this mentioned before going through my archives, so forgive me if this is old news, but I thought it might save some people some troubleshooting. Of course, it would be nice to have this incorporated in the modular archetypes.

When I create a new project using the modular Spring MVC archetype, there is a hibernate.cfg,xml file in core/src/main/resources, which gets ignored at runtime because maven-war-plugin overlays a copy in WEB-INF/classes that gets picked up instead.

I added this to my web project's pom.xml to fix this:

<build>
  <plugins>

    [...]

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-war-plugin</artifactId>
      <version>2.0.2</version>
      <configuration>
<dependentWarExcludes>WEB-INF/classes/hibernate.cfg.xml</ dependentWarExcludes>
      </configuration>
    </plugin>

    [...]

  </plugins>
</build>


Cheers
Rob

Reply via email to