maven - How to define conditional property in pom.xml? -
i'd define conditional property in pom.xml based on property. e.g. property p1=value1 when feature1.enabled=true , p1=value2 when feature1.enabled=false
mvn compile -dfeature1.enabled=true
you try using maven build profiles, like:
<profiles> <profile> <id>feature1-enabled</id> <activation> <property> <name>feature1.enabled</name> <value>true</value> </property> </activation> <properties> <p1>value1</p1> </properties> </profile> <profile> <id>feature1-disabled</id> <activation> <property> <name>feature1.enabled</name> <value>false</value> </property> </activation> <properties> <p1>value2</p1> </properties> </profile> </profiles>
usage:
mvn compile -dfeature1.enabled=true
Comments
Post a Comment