1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.jxr.stubs;
20
21 import java.io.FileReader;
22 import java.util.ArrayList;
23 import java.util.List;
24
25 import org.apache.maven.artifact.Artifact;
26 import org.apache.maven.model.Model;
27 import org.apache.maven.model.ReportPlugin;
28 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
29
30
31
32
33 public class ExcludeConfigurationMavenProjectStub extends JxrProjectStub {
34 private List<ReportPlugin> reportPlugins = new ArrayList<>();
35
36 public ExcludeConfigurationMavenProjectStub() {
37 MavenXpp3Reader pomReader = new MavenXpp3Reader();
38 Model model = null;
39
40 try {
41 model = pomReader.read(new FileReader(getBasedir()
42 + "/src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml"));
43 setModel(model);
44 } catch (Exception ignored) {
45
46 }
47
48 setArtifactId(model.getArtifactId());
49 setGroupId(model.getGroupId());
50 setVersion(model.getVersion());
51 setPackaging(model.getPackaging());
52 setInceptionYear(model.getInceptionYear());
53
54 String basedir = getBasedir().getAbsolutePath();
55 List<String> compileSourceRoots = new ArrayList<>();
56 compileSourceRoots.add(basedir + "/src/test/resources/unit/exclude-configuration/exclude/configuration");
57 setCompileSourceRoots(compileSourceRoots);
58
59
60 reportPlugins = new ArrayList<>(model.getReporting().getPlugins());
61
62 Artifact artifact = new JxrPluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging());
63 artifact.setArtifactHandler(new DefaultArtifactHandlerStub());
64 setArtifact(artifact);
65 }
66
67 @Override
68 public List<ReportPlugin> getReportPlugins() {
69 return reportPlugins;
70 }
71 }