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 import org.apache.maven.shared.model.fileset.FileSet;
7
8
9
10
11
12
13
14
15 @Mojo(name = "addTestSources", defaultPhase = LifecyclePhase.INITIALIZE, threadSafe = true)
16 public class AddTestSourcesMojo extends AbstractGroovySourcesMojo {
17
18
19
20
21
22 @Parameter
23 protected FileSet[] testSources;
24
25
26
27
28 @Override
29 public void execute() {
30 for (FileSet testSource : getTestFilesets(testSources, false)) {
31 addTestSourcePath(testSource.getDirectory());
32 }
33 }
34
35
36
37
38
39
40 protected void addTestSourcePath(final String path) {
41 if (!project.getTestCompileSourceRoots().contains(path)) {
42 getLog().debug("Added test source directory: " + path);
43 project.addTestCompileSourceRoot(path);
44 }
45 }
46
47 }