运行 2 main via exec-maven-plugin with 2 profils
run 2 main via exec-maven-plugin with 2 profils
我想要 运行 2 main via exec-maven-plugin with 2 profiles。在我的生产中,我只使用 "prod" 配置文件,在我的连续集成中,我想使用 "preProd" 配置文件和 "prod" 配置文件。
在产品中
mvn -Pprod
连续积分:
mvn -PpreProd,prod
<profiles>
<profile>
<id>preProd</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>CountContinusIntegr-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.mycompany.CountContinusIntegr</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>RunMyProd-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.mycompany.RunMyProd</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
当我 运行 maven 命令时,我有这个日志(com.mycompany.RunMyProd.main() 运行 2 次):
[INFO] --- exec-maven-plugin:1.5.0:java (CountContinusIntegr-execution) @ myproject ---
[2016-12-06 15:44:44]:读取文件scenarios.properties
0 [com.mycompany.RunMyProd.main()] 信息 ....
[信息] --- exec-maven-plugin:1.5.0:java (RunMyProd-execution) @ myproject ---
[2016-12-06 15:44:45]:读取文件scenarios.properties
0 [com.mycompany.RunMyProd.main()] 信息 ....
我找到了解决方案: I put <configuration> in <execution>
<profiles>
<profile>
<id>preProd</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>CountContinusIntegr-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.mycompany.CountContinusIntegr</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>RunMyProd-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.mycompany.RunMyProd</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
我想要 运行 2 main via exec-maven-plugin with 2 profiles。在我的生产中,我只使用 "prod" 配置文件,在我的连续集成中,我想使用 "preProd" 配置文件和 "prod" 配置文件。
在产品中
mvn -Pprod
连续积分:
mvn -PpreProd,prod
<profiles>
<profile>
<id>preProd</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>CountContinusIntegr-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.mycompany.CountContinusIntegr</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>RunMyProd-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.mycompany.RunMyProd</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
当我 运行 maven 命令时,我有这个日志(com.mycompany.RunMyProd.main() 运行 2 次):
[INFO] --- exec-maven-plugin:1.5.0:java (CountContinusIntegr-execution) @ myproject --- [2016-12-06 15:44:44]:读取文件scenarios.properties 0 [com.mycompany.RunMyProd.main()] 信息 .... [信息] --- exec-maven-plugin:1.5.0:java (RunMyProd-execution) @ myproject --- [2016-12-06 15:44:45]:读取文件scenarios.properties 0 [com.mycompany.RunMyProd.main()] 信息 ....
我找到了解决方案: I put <configuration> in <execution>
<profiles>
<profile>
<id>preProd</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>CountContinusIntegr-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.mycompany.CountContinusIntegr</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>RunMyProd-execution</id>
<phase>compile</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.mycompany.RunMyProd</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>