1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.resources;
20
21 import java.io.File;
22 import java.util.List;
23
24 import org.apache.maven.model.Resource;
25 import org.apache.maven.plugin.MojoExecutionException;
26 import org.apache.maven.plugins.annotations.LifecyclePhase;
27 import org.apache.maven.plugins.annotations.Mojo;
28 import org.apache.maven.plugins.annotations.Parameter;
29
30
31
32
33
34
35
36
37 @Mojo(
38 name = "testResources",
39 defaultPhase = LifecyclePhase.PROCESS_TEST_RESOURCES,
40 requiresProject = true,
41 threadSafe = true)
42 public class TestResourcesMojo extends ResourcesMojo {
43
44
45
46 @Parameter(defaultValue = "${project.build.testOutputDirectory}", required = true)
47 private File outputDirectory;
48
49
50
51
52 @Parameter(defaultValue = "${project.testResources}", required = true)
53 private List<Resource> resources;
54
55
56
57
58
59
60 @Parameter(property = "maven.test.skip", defaultValue = "false")
61 private boolean skip;
62
63
64
65
66 public void execute() throws MojoExecutionException {
67 if (skip) {
68 getLog().info("Not copying test resources");
69 } else {
70 super.execute();
71 }
72 }
73
74
75 public File getOutputDirectory() {
76 return outputDirectory;
77 }
78
79
80 public void setOutputDirectory(File outputDirectory) {
81 this.outputDirectory = outputDirectory;
82 }
83
84
85 public List<Resource> getResources() {
86 return resources;
87 }
88
89
90 public void setResources(List<Resource> resources) {
91 this.resources = resources;
92 }
93 }