title: Jar file name problems in persistence.xml
body: <p>We have a maven build that creates an ear file that includes libraries with JPA entities in its internal <code>lib</code> folder. The ear file has one <code>persistence.xml</code>, where we add the entities using the <code>&lt;jar-file&gt;</code> tag:</p>
  
  <pre><code>&lt;persistence-unit name="some-id"&gt;
      &lt;jar-file&gt;MyEntities-1.0.0-SNAPSHOT.jar&lt;/jar-file&gt;
  </code></pre>
  
  <p>The <code>MyEntities</code> lib is build with a separate maven project.</p>
  
  <p>This works fine as long as the build is done locally, iaw, I only use <code>mvn install</code> and do not deploy to a remote snapshot repository. It fails, when we start deploying to a repo because of  different jar file names in the local <code>.m2</code> repo and the remote repo:</p>
  
  <p><code>mvn install</code> creates a file named <code>MyEntities-1.0.0-SNAPSHOT.jar</code> on the local repo, <code>mvn deploy</code> a file named <code>MyEntities-1.0.0-20131212-145600-42.jar</code> on the remote repository.</p>
  
  <p>Now, if someone deployed after my last local build and maven looks for new snapshot updates (policy based or with <code>-U</code> flag), it pulls the remote file to the local repo and the jar with THAT name is copied to the ear, which causes JPA errors at deploy time because the entities can't be found (different jar file declared in persistence.xml).</p>
  
  <p>Is there a solution to that problem apart from always building locally before assembling the ear file?</p>