View Javadoc

1   package org.apache.maven.artifact;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.File;
23  import java.util.Collection;
24  import java.util.List;
25  import java.util.regex.Pattern;
26  
27  import org.apache.maven.artifact.handler.ArtifactHandler;
28  import org.apache.maven.artifact.metadata.ArtifactMetadata;
29  import org.apache.maven.artifact.repository.ArtifactRepository;
30  import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
31  import org.apache.maven.artifact.versioning.ArtifactVersion;
32  import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
33  import org.apache.maven.artifact.versioning.VersionRange;
34  
35  public interface Artifact
36      extends Comparable<Artifact>
37  {
38  
39      String RELEASE_VERSION = "RELEASE";
40  
41      String LATEST_VERSION = "LATEST";
42  
43      String SNAPSHOT_VERSION = "SNAPSHOT";
44  
45      Pattern VERSION_FILE_PATTERN = Pattern.compile( "^(.*)-([0-9]{8}.[0-9]{6})-([0-9]+)$" );
46  
47      // TODO: into artifactScope handler
48  
49      String SCOPE_COMPILE = "compile";
50  
51      String SCOPE_COMPILE_PLUS_RUNTIME = "compile+runtime";
52  
53      String SCOPE_TEST = "test";
54  
55      String SCOPE_RUNTIME = "runtime";
56  
57      String SCOPE_RUNTIME_PLUS_SYSTEM = "runtime+system";
58  
59      String SCOPE_PROVIDED = "provided";
60  
61      String SCOPE_SYSTEM = "system";
62  
63      String SCOPE_IMPORT = "import";   // Used to import dependencyManagement dependencies
64  
65      String getGroupId();
66  
67      String getArtifactId();
68  
69      String getVersion();
70  
71      void setVersion( String version );
72  
73      String getScope();
74  
75      String getType();
76  
77      String getClassifier();
78  
79      boolean hasClassifier();
80  
81      File getFile();
82  
83      void setFile( File destination );
84  
85      String getBaseVersion();
86  
87      void setBaseVersion( String baseVersion );
88  
89      String getId();
90  
91      String getDependencyConflictId();
92  
93      void addMetadata( ArtifactMetadata metadata );
94  
95      Collection<ArtifactMetadata> getMetadataList();
96  
97      void setRepository( ArtifactRepository remoteRepository );
98  
99      ArtifactRepository getRepository();
100 
101     void updateVersion( String version, ArtifactRepository localRepository );
102 
103     String getDownloadUrl();
104 
105     void setDownloadUrl( String downloadUrl );
106 
107     ArtifactFilter getDependencyFilter();
108 
109     void setDependencyFilter( ArtifactFilter artifactFilter );
110 
111     ArtifactHandler getArtifactHandler();
112 
113     List<String> getDependencyTrail();
114 
115     void setDependencyTrail( List<String> dependencyTrail );
116 
117     void setScope( String scope );
118 
119     VersionRange getVersionRange();
120 
121     void setVersionRange( VersionRange newRange );
122 
123     void selectVersion( String version );
124 
125     void setGroupId( String groupId );
126 
127     void setArtifactId( String artifactId );
128 
129     boolean isSnapshot();
130 
131     void setResolved( boolean resolved );
132 
133     boolean isResolved();
134 
135     void setResolvedVersion( String version );
136 
137     void setArtifactHandler( ArtifactHandler handler );
138 
139     boolean isRelease();
140 
141     void setRelease( boolean release );
142 
143     List<ArtifactVersion> getAvailableVersions();
144 
145     void setAvailableVersions( List<ArtifactVersion> versions );
146 
147     boolean isOptional();
148 
149     void setOptional( boolean optional );
150 
151     ArtifactVersion getSelectedVersion()
152         throws OverConstrainedVersionException;
153 
154     boolean isSelectedVersionKnown()
155         throws OverConstrainedVersionException;
156 
157 }