Note that there are some explanatory texts on larger screens.

plurals
  1. POMaven: Only want to run profile if doing a build on the parent pom
    text
    copied!<p>I'm using Maven 3.0.3. I have a project that inherits from a parent …</p> <pre><code> &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.myco.util.ant&lt;/groupId&gt; &lt;artifactId&gt;selenium-framework&lt;/artifactId&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;name&gt;Myco Selenium Utils&lt;/name&gt; &lt;parent&gt; &lt;groupId&gt;com.nna&lt;/groupId&gt; &lt;artifactId&gt;parent&lt;/artifactId&gt; &lt;version&gt;1.2-SNAPSHOT&lt;/version&gt; &lt;relativePath&gt;../parent&lt;/relativePath&gt; &lt;/parent&gt; </code></pre> <p>In my parent pom I have the below profile. However, I only want this profile to be active if someone is doing a build on the parent pom, as opposed to one of its children. Does anyone know how I can adjust the below so that it won't be activated if someone is doing a build of a child project?</p> <pre><code> &lt;profile&gt; &lt;id&gt;deploy-snapshot&lt;/id&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt; &lt;version&gt;1.6&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;deploy&lt;/phase&gt; &lt;configuration&gt; &lt;target&gt; &lt;condition property="is-release"&gt; &lt;not&gt; &lt;contains string="${project.version}" substring="SNAPSHOT" /&gt; &lt;/not&gt; &lt;/condition&gt; &lt;fail if="is-release" message="You can only deploy snapshot versions of this project." /&gt; &lt;/target&gt; &lt;/configuration&gt; &lt;goals&gt; &lt;goal&gt;run&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;activation&gt; &lt;activeByDefault&gt;true&lt;/activeByDefault&gt; &lt;/activation&gt; &lt;/profile&gt; </code></pre> <p>Thanks, - Dave </p>
 

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