net.jangaroo.jooc.mvnplugin.SenchaAppWatchMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jangaroo-maven-plugin Show documentation
Show all versions of jangaroo-maven-plugin Show documentation
This plugin compiles Jangaroo sources to JavaScript.
package net.jangaroo.jooc.mvnplugin;
import net.jangaroo.jooc.mvnplugin.sencha.SenchaUtils;
import net.jangaroo.jooc.mvnplugin.sencha.executor.SenchaCmdExecutor;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import java.io.File;
/**
* Start "sencha app watch" for a jangaroo-app project.
*/
@Mojo(name = "app-watch", threadSafe = true)
public class SenchaAppWatchMojo extends AbstractMojo {
@Parameter(defaultValue = "${project.build.directory}" + SenchaUtils.APP_TARGET_DIRECTORY)
private File appTargetDir;
@Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;
/**
* The log level to use for Sencha Cmd.
* The log level for Maven is kind of the base line which determines which log entries are actually shown in the output.
* When you Maven log level is "info", no "debug" messages for Sencha Cmd are logged.
* If no log level is given, the Maven log level will be used.
*/
@Parameter(property = "senchaLogLevel")
private String senchaLogLevel;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (!Type.JANGAROO_APP_PACKAGING.equals(project.getPackaging())) {
throw new MojoExecutionException("This goal only supports projects with packaging type \"jangaroo-app\"");
}
String arguments = "app watch";
getLog().info("Starting \"sencha app watch\"");
SenchaCmdExecutor senchaCmdExecutor = new SenchaCmdExecutor(appTargetDir, arguments, getLog(), senchaLogLevel);
senchaCmdExecutor.execute();
}
}