/**
 * Copyright 2014 Google Inc. All Rights Reserved.
 */
package com.google.appengine.gcloudapp;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

import java.io.File;
import java.util.ArrayList;

/**
 * Starts the Gcloud App Engine development server and does not wait.
 *
 * @author Ludo
 * @goal run_start
 * @execute phase="validate"
 * @threadSafe false
 */
public class GcloudAppAsyncStart extends GCloudAppRun {

  @Override
  public void execute() throws MojoExecutionException, MojoFailureException {
    getLog().info("");
    getLog().info("Gcloud SDK - Starting the Development Server");
    getLog().info("");

    if(application_directory == null) {
      application_directory = maven_project.getBuild().getDirectory() + "/" + maven_project.getBuild().getFinalName();
    }
    
    File appDirFile = new File(application_directory);

    if(!appDirFile.exists()) {
      throw new MojoExecutionException("The application directory does not exist : " + application_directory);
    }

    if(!appDirFile.isDirectory()) {
      throw new MojoExecutionException("The application directory is not a directory : " + application_directory);
    }

    ArrayList<String> devAppServerCommand = getCommand(application_directory);

    startCommand(appDirFile, devAppServerCommand, WaitDirective.WAIT_SERVER_STARTED);
  }

}

/**
 * Copyright 2014 Google Inc. All Rights Reserved.
 */
package com.google.appengine.gcloudapp;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

import java.io.File;
import java.util.ArrayList;

/**
 * Starts the Gcloud App Engine development server and does not wait.
 *
 * @author Ludo
 * @goal run_start
 * @execute phase="package"
 * @threadSafe false
 */
public class GcloudAppAsyncStart extends GCloudAppRun {

  @Override
  public void execute() throws MojoExecutionException, MojoFailureException {
    getLog().info("");
    getLog().info("Gcloud SDK - Starting the Development Server");
    getLog().info("");

    if(application_directory == null) {
      application_directory = maven_project.getBuild().getDirectory() + "/" + maven_project.getBuild().getFinalName();
    }
    
    File appDirFile = new File(application_directory);

    if(!appDirFile.exists()) {
      throw new MojoExecutionException("The application directory does not exist : " + application_directory);
    }

    if(!appDirFile.isDirectory()) {
      throw new MojoExecutionException("The application directory is not a directory : " + application_directory);
    }

    ArrayList<String> devAppServerCommand = getCommand(application_directory);

    startCommand(appDirFile, devAppServerCommand, WaitDirective.WAIT_SERVER_STARTED);
  }

}

Make the run_start goal build the project first.
Make the run_start goal build the project first.