View Javadoc
1   package org.codehaus.gmavenplus.mojo;
2   
3   import org.apache.maven.plugins.annotations.Mojo;
4   import org.apache.maven.plugins.annotations.Parameter;
5   
6   import java.io.File;
7   
8   
9   /**
10   * Adds Groovy test stubs directory back to Maven's list of test source directories. Normally, you won't need to use this mojo.
11   *
12   * @author Keegan Witt
13   * @since 1.1
14   */
15  @Mojo(name = "addTestStubSources", threadSafe = true)
16  public class AddTestStubSourcesMojo extends AbstractGroovyStubSourcesMojo {
17  
18      /**
19       * The location for the compiled test classes.
20       */
21      @Parameter(defaultValue = "${project.build.directory}/generated-sources/groovy-stubs/test")
22      protected File testStubsOutputDirectory;
23  
24      /**
25       * Flag to allow adding test sources to be skipped.
26       */
27      @Parameter(property = "maven.test.skip", defaultValue = "false")
28      protected boolean skipTests;
29  
30      /**
31       * Executes this mojo.
32       */
33      @Override
34      public void execute() {
35          if (!skipTests) {
36              getLog().debug("Added test stub directory " + testStubsOutputDirectory.getAbsolutePath() + " to project test sources.");
37              project.addTestCompileSourceRoot(testStubsOutputDirectory.getAbsolutePath());
38          }
39      }
40  
41  }