1 package org.apache.maven.plugin.idea.stubs;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.artifact.versioning.ArtifactVersion;
23 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
24 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
25 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
26
27 import java.io.File;
28
29
30
31
32 public class IdeaArtifactStub
33 extends ArtifactStub
34 {
35 private String groupId;
36
37 private String artifactId;
38
39 private String version;
40
41 private File file;
42
43 private String scope;
44
45
46 public void setGroupId( String groupId )
47 {
48 this.groupId = groupId;
49 }
50
51 public String getGroupId()
52 {
53 return groupId;
54 }
55
56 public void setArtifactId( String artifactId )
57 {
58 this.artifactId = artifactId;
59 }
60
61 public String getArtifactId()
62 {
63 return artifactId;
64 }
65
66 public void setVersion( String version )
67 {
68 this.version = version;
69 }
70
71 public String getVersion()
72 {
73 return version;
74 }
75
76 public File getFile()
77 {
78 return file;
79 }
80
81 public void setFile( File file )
82 {
83 this.file = file;
84 }
85
86 public String getType()
87 {
88 return "jar";
89 }
90
91 public ArtifactVersion getSelectedVersion()
92 throws OverConstrainedVersionException
93 {
94 return new DefaultArtifactVersion( getVersion() );
95 }
96
97 public String getId()
98 {
99 return getGroupId() + ":" + getArtifactId() + ":" + getVersion();
100 }
101
102 public void setScope( String scope )
103 {
104 this.scope = scope;
105 }
106
107 public String getScope()
108 {
109 if ( scope == null )
110 {
111 scope = super.getScope();
112 }
113
114 return scope;
115 }
116 }