1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.resources.remote.stub;
20
21 import org.apache.maven.model.Resource;
22
23
24
25
26 public class MavenProjectResourcesStub extends MavenProjectBuildStub {
27
28 public MavenProjectResourcesStub(String id) throws Exception {
29 super(id);
30 setupResources();
31 setupTestResources();
32 }
33
34 public void addInclude(String pattern) {
35 build.getResources().get(0).addInclude(pattern);
36 }
37
38 public void addExclude(String pattern) {
39 build.getResources().get(0).addExclude(pattern);
40 }
41
42 public void addTestInclude(String pattern) {
43 build.getTestResources().get(0).addInclude(pattern);
44 }
45
46 public void addTestExclude(String pattern) {
47 build.getTestResources().get(0).addExclude(pattern);
48 }
49
50 public void setTargetPath(String path) {
51 build.getResources().get(0).setTargetPath(path);
52 }
53
54 public void setTestTargetPath(String path) {
55 build.getTestResources().get(0).setTargetPath(path);
56 }
57
58 public void setDirectory(String dir) {
59 build.getResources().get(0).setDirectory(dir);
60 }
61
62 public void setTestDirectory(String dir) {
63 build.getTestResources().get(0).setDirectory(dir);
64 }
65
66 public void setResourceFiltering(int nIndex, boolean filter) {
67 if (build.getResources().size() > nIndex) {
68 build.getResources().get(nIndex).setFiltering(filter);
69 }
70 }
71
72 private void setupResources() {
73 Resource resource = new Resource();
74
75
76
77
78
79 resource.setDirectory(getBasedir().getPath() + "/src/main/resources");
80 resource.setFiltering(false);
81 resource.setTargetPath(null);
82 build.addResource(resource);
83 }
84
85 private void setupTestResources() {
86 Resource resource = new Resource();
87
88
89
90
91
92 resource.setDirectory(getBasedir().getPath() + "/src/test/resources");
93 resource.setFiltering(false);
94 resource.setTargetPath(null);
95 build.addTestResource(resource);
96 }
97 }