1 package org.apache.maven.artifact;
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.handler.ArtifactHandler;
23 import org.apache.maven.artifact.metadata.ArtifactMetadata;
24 import org.apache.maven.artifact.repository.ArtifactRepository;
25 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
26 import org.apache.maven.artifact.versioning.ArtifactVersion;
27 import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
28 import org.apache.maven.artifact.versioning.VersionRange;
29
30 import java.io.File;
31 import java.util.Collection;
32 import java.util.List;
33 import java.util.regex.Pattern;
34
35
36
37
38
39
40
41 public interface Artifact
42 extends Comparable<Artifact>
43 {
44 String LATEST_VERSION = "LATEST";
45
46 String SNAPSHOT_VERSION = "SNAPSHOT";
47
48 Pattern VERSION_FILE_PATTERN = Pattern.compile( "^(.*)-([0-9]{8}.[0-9]{6})-([0-9]+)$" );
49
50
51 String SCOPE_COMPILE = "compile";
52
53 String SCOPE_TEST = "test";
54
55 String SCOPE_RUNTIME = "runtime";
56
57 String SCOPE_PROVIDED = "provided";
58
59 String SCOPE_SYSTEM = "system";
60
61 String SCOPE_IMPORT = "import";
62
63 String RELEASE_VERSION = "RELEASE";
64
65 String getGroupId();
66
67 String getArtifactId();
68
69 String getVersion();
70
71 void setVersion( String version );
72
73
74
75
76
77
78
79
80 String getScope();
81
82 String getType();
83
84 String getClassifier();
85
86
87 boolean hasClassifier();
88
89 File getFile();
90
91 void setFile( File destination );
92
93 String getBaseVersion();
94
95
96
97
98 void setBaseVersion( String baseVersion );
99
100
101
102 String getId();
103
104 String getDependencyConflictId();
105
106 void addMetadata( ArtifactMetadata metadata );
107
108 ArtifactMetadata getMetadata( Class<?> metadataClass );
109
110 Collection<ArtifactMetadata> getMetadataList();
111
112 void setRepository( ArtifactRepository remoteRepository );
113
114 ArtifactRepository getRepository();
115
116 void updateVersion( String version, ArtifactRepository localRepository );
117
118 String getDownloadUrl();
119
120 void setDownloadUrl( String downloadUrl );
121
122 ArtifactFilter getDependencyFilter();
123
124 void setDependencyFilter( ArtifactFilter artifactFilter );
125
126 ArtifactHandler getArtifactHandler();
127
128
129
130
131 List<String> getDependencyTrail();
132
133
134
135
136 void setDependencyTrail( List<String> dependencyTrail );
137
138 void setScope( String scope );
139
140 VersionRange getVersionRange();
141
142 void setVersionRange( VersionRange newRange );
143
144 void selectVersion( String version );
145
146 void setGroupId( String groupId );
147
148 void setArtifactId( String artifactId );
149
150 boolean isSnapshot();
151
152 void setResolved( boolean resolved );
153
154 boolean isResolved();
155
156 void setResolvedVersion( String version );
157
158
159
160
161 void setArtifactHandler( ArtifactHandler handler );
162
163 boolean isRelease();
164
165 void setRelease( boolean release );
166
167 List<ArtifactVersion> getAvailableVersions();
168
169 void setAvailableVersions( List<ArtifactVersion> versions );
170
171 boolean isOptional();
172
173 void setOptional( boolean optional );
174
175 ArtifactVersion getSelectedVersion()
176 throws OverConstrainedVersionException;
177
178 boolean isSelectedVersionKnown()
179 throws OverConstrainedVersionException;
180 }