1 package org.codehaus.gmavenplus.mojo;
2
3 import org.apache.maven.plugins.annotations.LifecyclePhase;
4 import org.apache.maven.plugins.annotations.Mojo;
5 import org.apache.maven.plugins.annotations.Parameter;
6
7 import java.io.File;
8
9
10
11
12
13
14
15
16 @Mojo(name = "removeTestStubs", defaultPhase = LifecyclePhase.TEST_COMPILE, threadSafe = true)
17 public class RemoveTestStubsMojo extends AbstractGroovyStubSourcesMojo {
18
19
20
21
22 @Parameter(defaultValue = "${project.build.directory}/generated-sources/groovy-stubs/test")
23 protected File testStubsOutputDirectory;
24
25
26
27
28 @Parameter(property = "maven.test.skip", defaultValue = "false")
29 protected boolean skipTests;
30
31
32
33
34 @Override
35 public void execute() {
36 if (!skipTests) {
37 try {
38 project.getTestCompileSourceRoots().remove(testStubsOutputDirectory.getAbsolutePath());
39 } catch (UnsupportedOperationException e) {
40 try {
41 removeSourceRoot(project, "test", testStubsOutputDirectory);
42 } catch (Throwable e2) {
43 e.addSuppressed(e2);
44 throw e;
45 }
46 }
47 }
48 }
49
50 }