Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you can do is to define two <a href="http://maven.apache.org/guides/introduction/introduction-to-profiles.html" rel="nofollow noreferrer">profiles</a>, one per JDK used. Each profile will be activated regarding which JDK is used:</p> <pre><code>&lt;profiles&gt; &lt;profile&gt; &lt;id&gt;profile-for-jdk1.4&lt;/id&gt; &lt;activation&gt; &lt;activeByDefault&gt;false&lt;/activeByDefault&gt; &lt;jdk&gt;1.4&lt;/jdk&gt; &lt;/activation&gt; &lt;build&gt; &lt;finalName&gt;myBuild-jdk1.4&lt;/finalName&gt; &lt;/build&gt; &lt;/profile&gt; &lt;profile&gt; &lt;id&gt;profile-for-jdk1.5&lt;/id&gt; &lt;activation&gt; &lt;activeByDefault&gt;false&lt;/activeByDefault&gt; &lt;jdk&gt;1.5&lt;/jdk&gt; &lt;/activation&gt; &lt;build&gt; &lt;finalName&gt;myBuild-jdk1.5&lt;/finalName&gt; &lt;/build&gt; &lt;/profile&gt; &lt;/profiles&gt; </code></pre> <p>Then, in each profile, you define a specific <code>&lt;finalName&gt;</code>, which will be used to name the generated JAR file.</p> <p>Thus, if you build your application using JDK 1.4, the generated JAR will be named <code>myBuild-jdk1.4.jar</code>.</p> <p>If your final package is built using an assembly, you can simply change the <code>&lt;build&gt;</code> block inside profiles to configure the assembly plugin (for example to <code>&lt;finalName&gt;</code>).</p> <hr/> <p><em>Regarding your comment:</em> Indeed, this procedure will need two separate builds on Maven, as you have to recompile the whole project when changing the JDK version. One of the Maven2 convention is that one project = one artifact. What you want is to have one project with two artifacts.</p> <p>Eventually, one solution is to use <a href="http://hudson-ci.org/" rel="nofollow noreferrer">Hudson</a> to build your application, and especially the <a href="https://stackoverflow.com/questions/424295/experience-with-hudson-building-matrix-project/424343#424343">matrix feature</a> of this tool, which allows you to run multiple builds with various parameters, in your case the JDK.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload