相对简单:
我有一个插件目标tomcat7:run
,它直接在Eclipse m2e中运行(完整命令将是mvn tomcat7:run
)。但它运行得太早(它认为process-classes
),跳过了测试阶段。我想让它在通过cli调用的测试阶段之后运行。
我尝试将default-cli阶段更改为package
而不是process-classes
,但这不起作用(阶段不会更改为包):
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
...
</configuration>
<executions>
<!-- Change phase, doesn't seem to change anything -->
<execution>
<id>default-cli</id>
<goals>
<goal>run</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
运行默认阶段,例如mvn package
和此执行
<execution>
<id>default-run</id>
<phase>package</phase>
</execution>
相反可行,但不是一个选项,因为我不想在创建真正的包时执行此操作(此插件启动嵌入式tomcat服务器)。我正在考虑配置文件,但我认为配置文件不适用于此类问题。
相关日志:
[INFO] >>> tomcat7-maven-plugin:2.3-SNAPSHOT:run (default-cli) > process-classes @ gmm >>>
[INFO]
[INFO] --- frontend-maven-plugin:0.0.26:gulp (gulp build) @ gmm ---
...
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gmm ---
...
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ gmm ---
...
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.3-SNAPSHOT:run (default-cli) < process-classes @ gmm <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.3-SNAPSHOT:run (default-cli) @ gmm ---
... (tomcat7:run log output here) ...