Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to run a plugin only for "war" package type in Maven?
    text
    copied!<p>Provided two Maven projects: J (jar), W (war); both depend on one parent P (pom). The parent has a plugin, which must only run for the project "W". </p> <p>How does one go about doing this: </p> <ul> <li>without creating separate parent projects</li> <li>without using a profile (so build must still be executed with <code>mvn clean package</code>)</li> </ul> <p><strong><em>J (jar)</em></strong></p> <pre><code>&lt;project&gt; &lt;parent&gt; &lt;artifactId&gt;P&lt;/artifactId&gt; &lt;/parent&gt; &lt;artifactId&gt;J&lt;/artifactId&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;/project&gt; </code></pre> <p><strong><em>W (war)</em></strong></p> <pre><code>&lt;project&gt; &lt;parent&gt; &lt;artifactId&gt;P&lt;/artifactId&gt; &lt;/parent&gt; &lt;artifactId&gt;W&lt;/artifactId&gt; &lt;packaging&gt;war&lt;/packaging&gt; &lt;/project&gt; </code></pre> <p><strong><em>P (pom)</em></strong></p> <pre><code>&lt;project&gt; &lt;artifactId&gt;P&lt;/artifactId&gt; &lt;packaging&gt;pom&lt;/packaging&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;jar&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;classifier&gt;classes&lt;/classifier&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre>
 

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