1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugins.dependency.testUtils.stubs;
20
21 import java.io.File;
22 import java.io.FileInputStream;
23 import java.io.IOException;
24
25 import org.apache.maven.model.Model;
26 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
27 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
28 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
29
30
31
32
33 public class DuplicateDependencies2ProjectStub extends MavenProjectStub {
34 public DuplicateDependencies2ProjectStub() {
35 File pom = new File(getBasedir(), "plugin-config2.xml");
36 MavenXpp3Reader pomReader = new MavenXpp3Reader();
37
38 try (FileInputStream in = new FileInputStream(pom)) {
39 Model model = pomReader.read(in);
40 setModel(model);
41
42 setGroupId(model.getGroupId());
43 setArtifactId(model.getArtifactId());
44 setVersion(model.getVersion());
45 setName(model.getName());
46 setUrl(model.getUrl());
47 setPackaging(model.getPackaging());
48 setFile(pom);
49 } catch (IOException | XmlPullParserException e) {
50 throw new RuntimeException(e);
51 }
52 }
53
54
55
56
57 public File getBasedir() {
58 return new File(super.getBasedir() + "/src/test/resources/unit/duplicate-dependencies");
59 }
60 }