0

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?

Andy Dennie
  • 6,012
  • 2
  • 32
  • 51

1 Answers1

1

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.

David
  • 5,481
  • 2
  • 20
  • 33
  • Yes, that would work of course, but what I want to ensure is that whenever the appengine:udpate goal is executed, the "clean" phase is executed as a prerequisite. The problem I'm having is that sometimes the wrong code is getting deployed, because the "compile" phase is performed with one profile activated, but the "appengine:update" goal is performed with another profile activated. Since the "appengine:update" goal just runs the "package" phase as a prerequisite and the code is already compiled, the wrong code gets packaged and deployed. – Andy Dennie Jan 24 '14 at 13:01
  • Good idea, but I tried it and it runs the "clean" *after* the "package" goal! – Andy Dennie Jan 25 '14 at 13:19
  • OK, I've edited the answer with a way to execute the clean before each build. The biggest issue with that is if you need to keep test data in the devserver : it will lose its datastore data each time you run a build. – David Jan 27 '14 at 02:09
  • Thanks; it's a "big hammer", but this will get the job done, so I'll accept it. If anyone else knows of a way to just override the "execute phase" of a mojo, please chime in. – Andy Dennie Jan 27 '14 at 13:53