title: Version number in jar name - how to handle persistence.xml?
body: <p>We are building ear-files with a large number of jars. Some of them contain persistence.xml files defining persistence units which reference other jars with </p>
  
  <pre><code>&lt;jar-file&gt;other.jar&lt;/jar-file&gt;
  </code></pre>
  
  <p>Now we plan to use Maven in the future and jar names now contain version numbers. This is a huge problem for the mechanism described above: Instead of <code>other.jar</code>, we need to specify <code>other-1.2.3.jar</code>. But the correct version number cannot be known when the jar is built because in the construction of the ear, the dependency mediation could replace <code>other-1.2.3.jar</code> with <code>other-2.3.4.jar</code> so that my reference in the persistence.xml of the jar becomes invalid. </p>
  
  <p>So my question is: How can I manage the persistence.xml files properly in Maven when building a large ear file?</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>Let me try to construct a small examples to make my point clearer:</p>
  
  <p>Let us have <code>first-ejb-1.0.0.jar</code> depending on <code>other-1.2.3.jar</code> and <code>second-ejb-1.0.0.jar</code> depending on <code>other-2.3.4.jar</code>. Both <code>first-ejb-1.0.0.jar</code> and <code>second-ejb-1.0.0.jar</code> contain a persistence.xml with a <code>&lt;jar-file&gt;</code> entry. <code>first-ejb-1.0.0.jar</code> points to <code>other-1.2.3.jar</code> and <code>second-ejb-1.0.0.jar</code> points to <code>other-2.3.4.jar</code>. So far, so good.</p>
  
  <p>Now I build an ear from <code>first-ejb-1.0.0.jar</code> and <code>second-ejb-1.0.0.jar</code>. The dependencies are resolved, but only one of the <code>other-*.jar</code> can be included in the ear. Say, our dependency mediation chooses <code>other-2.3.4.jar</code>. Then <code>first-ejb-1.0.0.jar</code> has a dead <code>&lt;jar-file&gt;</code> entry, pointing to a non-existent jar.</p>