Search code examples
google-app-enginemavenappengine-maven-plugin

how to override a maven mojo's "@execute phase"?


I'm using the appengine-maven-plugin, and having a problem with its "update" goal -- it's executing the "package" phase as a prerequisite:

/**
 * @goal update
 * @execute phase="package"
 */
public class Update extends AbstractAppCfgMojo {
  @Override
  public void execute() throws MojoExecutionException, MojoFailureException {
....

However, I need it to do a "clean" first, then do the "package". Is there a way I can override this?


Solution

  • have you tried ''mvn clean appengine:update" ? That should do.

    EDIT : There is a way to run mvn clean before each build, that might be good enough for you ? Note that it means that your local devserver's datastore will be completely deleted each time you run mvn appengine:devserver. (based on this page):

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    

    It will perform a clean before each build.