JBoss Community

Re: target/project.war different from project.war that is Run On Server

created by Tanya Ruttenberg in JBoss Tools - View the full discussion

This original problem is showing up again  -  though the details are different and I'm pretty sure this time it's not my mistake.

 

The file starts in src/main/resources/META-INF/persistence.xml

 

In the maven build, the persistence.xml is showing up in the right place, under META-INF.The eclipse build doesn't include the persistence.xml at all.

 

To coax maven into including persistence.xml into the WAR I include this in the pom.xml

 

<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
  <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
  <failOnMissingWebXml>false</failOnMissingWebXml>
  <webResources>
    <resource>
      <directory>src/main/resources/META-INF</directory>
      <!-- override the destination directory for this resource -->
      <targetPath>META-INF</targetPath>
      <includes>
        <include>persistence.xml</include>
      </includes>
    </resource>
  </webResources>
</configuration>
</plugin>

 

and this

 

<resources>
  <resource>
    <directory>src/resources/META-INF</directory>
    <excludes>
      <exclude>persistence.xml</exclude>
    </excludes>
  </resource>
</resources>

 

mvn package puts it into contacts-as7.war/META-INF

 

Run On Server doesn't put it anywhere and I get this error when I deploy

 

Can't find a persistence unit named null in deployment "contacts-as7.war"

 



Reply to this message by going to Community

Start a new discussion in JBoss Tools at Community