package com.shin1ogawa;

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

/**
 * stop the DevAppServerMain.
 * 
 * @goal stop
 * @phase post-integration-test
 * 
 * @author shin1ogawa
 */
public class StopMojo extends AbstractMojo {

	public void execute() throws MojoExecutionException, MojoFailureException {
		Process process = StartMojo.getProcess();
		if (process == null) {
			throw new MojoExecutionException(
					"DevAppServerMain is not started(?).");
		} else {
			getLog().info("stop DevAppServerMain: ");
			process.destroy();
		}
	}
}
