Maven有以下默认的生命周期步骤:
validate - validate the project is correct and all necessary information is available
compile - compile the source code of the project
test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
package - take the compiled code and package it in its distributable format, such as a JAR.
integration-test - process and deploy the package if necessary into an environment where integration tests can be run
verify - run any checks to verify the package is valid and meets quality criteria
install - install the package into the local repository, for use as a dependency in other projects locally
deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
maven gwt插件支持:gwt:compile
maven gae插件支持:gae:部署
但最底层的两个并不是默认maven生命周期的一部分(至少从我们的pom来看)。那么,在我们的构建机器上,我们应该在它上运行什么?
我们目前正在运行"mvn-test-gwt:compile gae:deploy"。对吗?
许多插件不会挂钩到默认的生命周期中,因为它们会做一些"奇怪"的事情,而这些事情通常并不有用。例如,GWT编译器需要很长时间。
如果你想将这样的插件添加到一个阶段,请使用execution
块(详细信息):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
这将在compile
阶段调用插件的目标compile
。
注意,对于GWT插件,phase
是可选的;如果您调用compile
,插件将做正确的事情。
由于剩下的阶段,deploy
有点麻烦:包太早了,应该在test
之后,在install
之前。所以对于deploy
,你可以用不同的相位进行实验。如果没有任何结果,您仍然需要调用mvn test gae:deploy