play.twirl.maven.TwirlCompileMojo Maven / Gradle / Ivy
The newest version!
/*
* Copyright (C) from 2022 The Play Framework Contributors , 2011-2021 Lightbend Inc.
*/
package play.twirl.maven;
import static org.apache.maven.plugins.annotations.LifecyclePhase.GENERATE_SOURCES;
import java.io.File;
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;
@Mojo(name = "compile", defaultPhase = GENERATE_SOURCES, threadSafe = true)
public class TwirlCompileMojo extends AbstractTwirlCompileMojo {
/**
* The directories in which the Twirl templates is found.
*
* Default: ${project.basedir}/src/main/twirl
*
*
Example:
*
*
{@code
* ${project.basedir}/src/main/templates
* }
*/
@Parameter(defaultValue = "${project.basedir}/src/main/twirl")
private File sourceDir;
/**
* The directory where the compiled Twirl templates are placed.
*
* Default: {@code ${project.build.directory}/generated-sources/twirl}
*
*
Example:
*
*
{@code
* ${project.build.directory}/generated-sources/twirl
* }
*/
@Parameter(defaultValue = "${project.build.directory}/generated-sources/twirl")
private File outputDir;
@Override
protected File getSourceDirectory() {
return sourceDir;
}
@Override
protected File getOutputDirectory() {
return outputDir;
}
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
super.execute();
project.addCompileSourceRoot(getOutputDirectory().getAbsolutePath());
getLog().info("Added generated Scala sources: " + getOutputDirectory());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy