I\'m trying to activate a maven profile using a property defined inside pom.xml
:
[...]
As mentioned in previous answers, profile activation only works with system properties.
But, with a little creativity you can achieve a similar result (conditional plugin execution) using pom properties. To achieve that, use the phase tag of the plugin you want to conditionally execute:
<project>
...
<properties>
<run.it>none</run.it>
<!-- <run.it>compile</run.it> -->
<!-- <run.it>package</run.it> -->
</properties>
...
<build>
...
<plugins>
<plugin>
<artifactId>your-plugin</artifactId>
<executions>
<execution>
<phase>${run.it}</phase>
</execution>
</executions>
</plugin>
</plugins>
...
</build>
</project>
The only difference is that you have to use a phase name instead of true/false. But you can change the property or override it freely as a property.