Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't know of a mechanism that does exactly what you need. Your best bet is to define a parent pom with those plugins defined in the build section, rather than the pluginManagement section. In this case the plugin configuration will always be defined. Adding the configuration to a profile in the parent means you can exercise some control over the activation of those plugins.</p> <p>One refinement to consider is that you can control activation of a profile by the presence or absence of a file. This way you can define the profile in the parent, but have it deactivated in that project because of the marker file being present in the parent. Child projects would not have the marker file in their source, so the profile would be activated for those projects. You can reverse the behaviour by using <code>missing</code> instead of <code>exists</code> if that makes sense for the majority of projects.</p> <pre><code>&lt;profile&gt; &lt;id&gt;build&lt;/id&gt; &lt;activation&gt; &lt;file&gt; &lt;missing&gt;src/main/resources/build.marker&lt;/missing&gt; &lt;!-- or if you want to enable the profile when the file does exist: &lt;exists&gt;src/main/resources/build.marker&lt;/exists--&gt; &lt;/file&gt; &lt;/activation&gt; &lt;build&gt; &lt;/plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;gmaven-plugin&lt;/artifactId&gt; ... &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt; ... &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;cargo-maven2-plugin&lt;/artifactId&gt; ... &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/profile&gt; </code></pre> <hr> <p>Alternatively, you could try writing custom plugin with a lifecycle that executes all the required mojos in a forked lifecycle. I recently answered <a href="https://stackoverflow.com/questions/1427740/how-do-i-execute-a-set-of-goals-before-my-maven-plugin-runs">another question</a> with details of how to do this.</p> <p>Another alternative is to write another plugin that uses Maven shared-io to apply a descriptor to the pom, that descriptor can define arbitrary configuration that is merged into the pom. Another <a href="https://stackoverflow.com/questions/1231561/how-to-share-common-properties-among-several-maven-projects/1265428#1265428">answer</a> describes how this can be done.</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. 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