如果设置了系统属性,我想运行"exec-maven插件"。如何在Maven3.x中实现这一点?
例如,给定:
mvn clean install -DrunTheExec="yes"
那么我该如何实现这个逻辑:
<!-- if $(runTheExec) == yes then run this plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
...
</plugin>
我正要添加与Johnathon相同的建议,但使用概要文件有点不同。
<profiles>
<profile>
<id>runTheExec</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
...
然后激活它:
mvn clean install -PrunTheExec
您需要在pom中定义一个概要文件,并在其中定义插件
<profiles>
<profile>
<activation>
<property>
<name>runTheExec</name>
<value>yes</value>
</property>
</activation>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
...
</plugin>
</plugins>
</profile>
</profiles>