Link to home
Start Free TrialLog in
Avatar of atxman
atxman

asked on

Maven profile activation based on multiple criteria

I have a maven pom that has 3 profiles. A linux profile and 2 windows profiles. When I run maven on windows, I want to check if the environment variable ITF_HOME exists and activate it when run on a cloud vm. When run on an on-premise VM, I want the 2nd profile to run. I don't see why both profiles are run when running on a cloud VM. We also can not set the -P command line option as our tool we use is unable to make this distinction when a specific profile can be run. This is my current profiles:

<profile>
  <id>cloud</id>
  <activation>      
    <property>        
      <name>env.ITF_HOME</name>      
    </property>    
  </activation>
  .
  .
  .
</profile>
<profile>
  <id>onpremise</id>
  <activation>      
    <property>        
      <name>!env.ITF_HOME</name>      
    </property>
    <os>
      <family>Windows</family>
    </os>
  </activation>
  .
  .
  .
</profile>
.

Thank you
ASKER CERTIFIED SOLUTION
Avatar of atxman
atxman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial