Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding dependencies in a Maven sub-module when a profile is activated
    primarykey
    data
    text
    <p>I have a project with a parent <code>pom.xml</code> which define profiles, and a <code>debug</code> profile :</p> <pre><code>&lt;profile&gt; &lt;id&gt;debug-true&lt;/id&gt; &lt;activation&gt; &lt;property&gt; &lt;name&gt;debug&lt;/name&gt; &lt;value&gt;true&lt;/value&gt; &lt;/property&gt; &lt;/activation&gt; &lt;/profile&gt; </code></pre> <p>I want that one of my sub-modules adds the dependency <code>jboss-seam-debug</code> when the profile <code>debug</code> is activated.</p> <p>I written this children pom.xml :</p> <pre><code>&lt;profiles&gt; &lt;profile&gt; &lt;id&gt;debug-true&lt;/id&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.jboss.seam&lt;/groupId&gt; &lt;artifactId&gt;jboss-seam-debug&lt;/artifactId&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/profile&gt; &lt;/profiles&gt; </code></pre> <p>But it doesn't work, that dependency is not part of the dependency tree when I specify <code>-Ddebug=true</code> ... it's like the children pom.xml re-defines my <code>debug</code> profile ...</p> <p>Do you know how could I add <code>jboss-seam-debug</code> dependency to my sub-module when the <strong>property</strong> <code>debug</code> has the value <code>true</code> ?</p> <hr> <p>Actually, here is my full need which is a bit more complex.</p> <p>Here is my parent <code>pom.xml</code> :</p> <pre><code>&lt;profiles&gt; &lt;profile&gt; &lt;id&gt;env-dev&lt;/id&gt; &lt;activation&gt; &lt;activeByDefault&gt;true&lt;/activeByDefault&gt; &lt;property&gt; &lt;name&gt;env&lt;/name&gt; &lt;value&gt;dev&lt;/value&gt; &lt;/property&gt; &lt;/activation&gt; &lt;properties&gt; &lt;debug&gt;true&lt;/debug&gt; ... other properties ... &lt;/properties&gt; &lt;/profile&gt; ... </code></pre> <p>Generally, I just pass <code>-Denv=dev</code> on the <code>mvn</code> command line and wanted my sub-module to activate <code>jboss-seam-debug</code> only when property <code>debug</code> is defined to <code>true</code> so I wrote that in the sub-module <code>pom.xml</code> :</p> <pre><code>&lt;profiles&gt; &lt;profile&gt; &lt;id&gt;debug-true&lt;/id&gt; &lt;activation&gt; &lt;property&gt; &lt;name&gt;debug&lt;/name&gt; &lt;value&gt;true&lt;/value&gt; &lt;/property&gt; &lt;/activation&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.jboss.seam&lt;/groupId&gt; &lt;artifactId&gt;jboss-seam-debug&lt;/artifactId&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/profile&gt; ... </code></pre> <p>which didn't work only by passing <code>-Denv=dev</code> because I don't pass the <strong>system</strong> property <code>-Ddebug=true</code>, it's the <strong>maven</strong> property which is activated by my parent <code>pom.xml</code>, and that my children doesn't "see" ...</p>
    singulars
    1. This table or related slice is empty.
    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. 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