【发布时间】:2016-11-21 14:16:07
【问题描述】:
我在 pom 中有以下插件:
<plugin>
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<configuration>
<version>${phantomjs.version}</version>
<checkSystemPath>false</checkSystemPath>
<skip>${skipTests}</skip>
</configuration>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
我想定义一个新的配置文件来自定义插件配置:
<profile>
<id>enduserTest</id>
<properties>
<tomcat.version>8.0.39</tomcat.version>
<skipTests>true</skipTests>
</properties>
<build>
<defaultGoal>clean verify cargo:run</defaultGoal>
<plugins>
<plugin>
<groupId>com.github.klieber</groupId>
<artifactId>phantomjs-maven-plugin</artifactId>
<configuration>
<version>${phantomjs.version}</version>
<checkSystemPath>false</checkSystemPath>
</configuration>
<executions>
<execution>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
唯一的区别是<skip>${skipTests}</skip>
线。
现在我想运行mvn -PenduserTest,但配置不会被覆盖。
有什么建议吗?有更好的解决方案吗?这是正确的策略吗?
【问题讨论】:
-
如果我在配置文件内部和外部定义这些插件,它就不起作用。但如果我只在配置文件中定义这些插件,它就可以正常工作。