2012-01-13 65 views
0

Maven有以下默認的生命週期步驟:Maven構建生命週期與谷歌應用程序引擎和谷歌Web工具包

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. 

行家GWT插件支持:GWT:編譯

行家GAE插件支持:GAE:部署

但底部的兩個都不是默認的Maven生命週期(至少從我們POM)的一部分。所以,我們的構建機器上,我們應該在其上運行?

我們目前正在運行的 「MVN測試GWT:編譯GAE:部署」。這樣對嗎?因爲他們做「古怪」事情是不是非常有用

回答

3

許多插件不勾到默認的生命週期。例如,GWT編譯器需要很長時間。

如果你想這樣的插件添加到一個階段,使用execution塊(details):

<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

+1

請注意,gwt:compile默認綁定到預包裝階段,而不是編譯階段(以便它在測試階段之後運行) – 2012-01-13 14:30:29