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