
play.twirl.maven.TwirlTestCompileMojo Maven / Gradle / Ivy
/*
* 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_TEST_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 = "testCompile", defaultPhase = GENERATE_TEST_SOURCES, threadSafe = true)
public class TwirlTestCompileMojo extends AbstractTwirlCompileMojo {
/**
* The directories in which the Twirl templates is found.
*
* Default: ${project.basedir}/src/test/twirl
*
*
Example:
*
*
{@code
* ${project.basedir}/src/test/templates
* }
*/
@Parameter(defaultValue = "${project.basedir}/src/test/twirl")
private File sourceDir;
/**
* The directory where the compiled Twirl templates are placed.
*
* Default: {@code ${project.build.directory}/generated-test-sources/twirl}
*
*
Example:
*
*
{@code
* ${project.build.directory}/generated-test-sources/twirl
* }
*/
@Parameter(defaultValue = "${project.build.directory}/generated-test-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.addTestCompileSourceRoot(getOutputDirectory().getAbsolutePath());
getLog().info("Added generated Test Scala sources: " + getOutputDirectory());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy