1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.checkstyle.stubs;
20
21 import java.io.File;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.List;
25
26 import org.apache.maven.artifact.DependencyResolutionRequiredException;
27 import org.apache.maven.model.Build;
28 import org.apache.maven.model.Organization;
29 import org.apache.maven.model.ReportPlugin;
30 import org.codehaus.plexus.PlexusTestCase;
31
32
33
34
35
36 public class MinMavenProjectStub extends CheckstyleProjectStub {
37
38 public List<String> getCompileClasspathElements() throws DependencyResolutionRequiredException {
39 return getCompileSourceRoots();
40 }
41
42
43 public List<String> getTestClasspathElements() throws DependencyResolutionRequiredException {
44 List<String> list = new ArrayList<>(getCompileClasspathElements());
45 list.add(PlexusTestCase.getBasedir() + "/target/test-classes");
46 return list;
47 }
48
49
50 public List<String> getCompileSourceRoots() {
51 return Collections.singletonList(PlexusTestCase.getBasedir() + "/target/classes");
52 }
53
54
55 public List<String> getTestCompileSourceRoots() {
56 List<String> list = new ArrayList<>(getCompileSourceRoots());
57 list.add(PlexusTestCase.getBasedir() + "/target/test-classes");
58 return list;
59 }
60
61
62 public File getBasedir() {
63 return new File(PlexusTestCase.getBasedir());
64 }
65
66
67 public List<ReportPlugin> getReportPlugins() {
68 ReportPlugin jxrPlugin = new ReportPlugin();
69
70 jxrPlugin.setArtifactId("maven-jxr-plugin");
71
72 return Collections.singletonList(jxrPlugin);
73 }
74
75
76 public Organization getOrganization() {
77 Organization organization = new Organization();
78
79 organization.setName("maven-plugin-tests");
80
81 return organization;
82 }
83
84
85 public String getInceptionYear() {
86 return "2006";
87 }
88
89
90 public Build getBuild() {
91 Build build = new Build();
92
93 build.setDirectory(PlexusTestCase.getBasedir() + "/target/test-harness/checkstyle/min");
94
95 return build;
96 }
97
98
99 public File getFile() {
100 File file = new File(getBasedir(), "pom.xml");
101
102 return file;
103 }
104 }