Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>is there anyway to make sure that user cannot install the module with only profile-b? or active the profile-a automatically if profile-b used alone?</p> </blockquote> <p>No, there is no way to trigger a profile from another one (not supported, see <a href="https://stackoverflow.com/questions/2246033/why-cant-i-activate-a-maven2-profile-from-another-profile/2248552#2248552">Brett's answer</a> to a related question) nor to strictly forbid the use of a given profile. </p> <p>The best thing you can do is to use property activation and a <em>common</em> property to activate both profiles:</p> <pre><code>&lt;project&gt; ... &lt;/dependencies&gt; &lt;profiles&gt; &lt;profile&gt; &lt;id&gt;profile-a&lt;/id&gt; &lt;activation&gt; &lt;property&gt; &lt;name&gt;propertyX&lt;/name&gt; &lt;/property&gt; &lt;/activation&gt; &lt;/profile&gt; &lt;profile&gt; &lt;id&gt;profile-b&lt;/id&gt; &lt;activation&gt; &lt;property&gt; &lt;name&gt;propertyX&lt;/name&gt; &lt;/property&gt; &lt;/activation&gt; &lt;/profile&gt; &lt;/profiles&gt; &lt;/project&gt; </code></pre> <p>And passing the property when invoking mvn would trigger both of them:</p> <pre> $ mvn help:active-profiles -DpropertyX [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Q4099626 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-help-plugin:2.1.1:active-profiles (default-cli) @ Q4099626 --- [INFO] Active Profiles for Project 'com.stackoverflow:Q4099626:jar:1.0-SNAPSHOT': The following profiles are active: - profile-a (source: pom) - profile-b (source: pom) </pre> <p>That's not ideal, but currently, that's the best you can get.</p> <h3>Related questions</h3> <ul> <li><a href="https://stackoverflow.com/questions/2246033/why-cant-i-activate-a-maven2-profile-from-another-profile">Why can't I activate a Maven2 profile from another profile?</a></li> <li><a href="https://stackoverflow.com/questions/943411/can-i-make-one-maven-profile-activate-another">Can I make one maven profile activate another?</a> </li> </ul>
    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.
    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