1 package org.apache.maven.project.artifact; 2 3 18 19 import org.apache.maven.artifact.Artifact; 20 import org.apache.maven.artifact.handler.ArtifactHandler; 21 import org.apache.maven.artifact.metadata.ArtifactMetadata; 22 import org.apache.maven.artifact.repository.ArtifactRepository; 23 import org.apache.maven.artifact.resolver.filter.ArtifactFilter; 24 import org.apache.maven.artifact.versioning.ArtifactVersion; 25 import org.apache.maven.artifact.versioning.OverConstrainedVersionException; 26 import org.apache.maven.artifact.versioning.VersionRange; 27 import org.apache.maven.project.MavenProject; 28 29 import java.io.File ; 30 import java.util.Collection ; 31 import java.util.List ; 32 33 42 public class ActiveProjectArtifact 43 implements Artifact 44 { 45 private final Artifact artifact; 46 47 private final MavenProject project; 48 49 public ActiveProjectArtifact( MavenProject project, Artifact artifact ) 50 { 51 this.artifact = artifact; 52 this.project = project; 53 54 artifact.setFile( project.getArtifact().getFile() ); 55 artifact.setResolved( true ); 56 } 57 58 public File getFile() 59 { 60 return project.getArtifact().getFile(); 62 } 63 64 public String getGroupId() 65 { 66 return artifact.getGroupId(); 67 } 68 69 public String getArtifactId() 70 { 71 return artifact.getArtifactId(); 72 } 73 74 public String getVersion() 75 { 76 return artifact.getVersion(); 77 } 78 79 public void setVersion( String version ) 80 { 81 artifact.setVersion( version ); 82 } 83 84 public String getScope() 85 { 86 return artifact.getScope(); 87 } 88 89 public String getType() 90 { 91 return artifact.getType(); 92 } 93 94 public String getClassifier() 95 { 96 return artifact.getClassifier(); 97 } 98 99 public boolean hasClassifier() 100 { 101 return artifact.hasClassifier(); 102 } 103 104 public void setFile( File destination ) 105 { 106 artifact.setFile( destination ); 107 project.getArtifact().setFile( destination ); 108 } 109 110 public String getBaseVersion() 111 { 112 return artifact.getBaseVersion(); 113 } 114 115 public void setBaseVersion( String baseVersion ) 116 { 117 artifact.setBaseVersion( baseVersion ); 118 } 119 120 public String getId() 121 { 122 return artifact.getId(); 123 } 124 125 public String getDependencyConflictId() 126 { 127 return artifact.getDependencyConflictId(); 128 } 129 130 public void addMetadata( ArtifactMetadata metadata ) 131 { 132 artifact.addMetadata( metadata ); 133 } 134 135 public Collection getMetadataList() 136 { 137 return artifact.getMetadataList(); 138 } 139 140 public void setRepository( ArtifactRepository remoteRepository ) 141 { 142 artifact.setRepository( remoteRepository ); 143 } 144 145 public ArtifactRepository getRepository() 146 { 147 return artifact.getRepository(); 148 } 149 150 public void updateVersion( String version, ArtifactRepository localRepository ) 151 { 152 artifact.updateVersion( version, localRepository ); 153 } 154 155 public String getDownloadUrl() 156 { 157 return artifact.getDownloadUrl(); 158 } 159 160 public void setDownloadUrl( String downloadUrl ) 161 { 162 artifact.setDownloadUrl( downloadUrl ); 163 } 164 165 public ArtifactFilter getDependencyFilter() 166 { 167 return artifact.getDependencyFilter(); 168 } 169 170 public void setDependencyFilter( ArtifactFilter artifactFilter ) 171 { 172 artifact.setDependencyFilter( artifactFilter ); 173 } 174 175 public ArtifactHandler getArtifactHandler() 176 { 177 return artifact.getArtifactHandler(); 178 } 179 180 public List getDependencyTrail() 181 { 182 return artifact.getDependencyTrail(); 183 } 184 185 public void setDependencyTrail( List dependencyTrail ) 186 { 187 artifact.setDependencyTrail( dependencyTrail ); 188 } 189 190 public void setScope( String scope ) 191 { 192 artifact.setScope( scope ); 193 } 194 195 public VersionRange getVersionRange() 196 { 197 return artifact.getVersionRange(); 198 } 199 200 public void setVersionRange( VersionRange newRange ) 201 { 202 artifact.setVersionRange( newRange ); 203 } 204 205 public void selectVersion( String version ) 206 { 207 artifact.selectVersion( version ); 208 } 209 210 public void setGroupId( String groupId ) 211 { 212 artifact.setGroupId( groupId ); 213 } 214 215 public void setArtifactId( String artifactId ) 216 { 217 artifact.setArtifactId( artifactId ); 218 } 219 220 public boolean isSnapshot() 221 { 222 return artifact.isSnapshot(); 223 } 224 225 public int compareTo( Object o ) 226 { 227 return artifact.compareTo( o ); 228 } 229 230 public void setResolved( boolean resolved ) 231 { 232 artifact.setResolved( resolved ); 233 } 234 235 public boolean isResolved() 236 { 237 return artifact.isResolved(); 238 } 239 240 public void setResolvedVersion( String version ) 241 { 242 artifact.setResolvedVersion( version ); 243 } 244 245 public void setArtifactHandler( ArtifactHandler handler ) 246 { 247 artifact.setArtifactHandler( handler ); 248 } 249 250 public String toString() 251 { 252 return "active project artifact:\n\tartifact = " + artifact + ";\n\tproject: " + project; 253 } 254 255 public boolean isRelease() 256 { 257 return artifact.isRelease(); 258 } 259 260 public void setRelease( boolean release ) 261 { 262 artifact.setRelease( release ); 263 } 264 265 public List getAvailableVersions() 266 { 267 return artifact.getAvailableVersions(); 268 } 269 270 public void setAvailableVersions( List versions ) 271 { 272 artifact.setAvailableVersions( versions ); 273 } 274 275 public boolean isOptional() 276 { 277 return artifact.isOptional(); 278 } 279 280 public ArtifactVersion getSelectedVersion() 281 throws OverConstrainedVersionException 282 { 283 return artifact.getSelectedVersion(); 284 } 285 286 public boolean isSelectedVersionKnown() 287 throws OverConstrainedVersionException 288 { 289 return artifact.isSelectedVersionKnown(); 290 } 291 292 public void setOptional( boolean optional ) 293 { 294 artifact.setOptional( optional ); 295 } 296 } 297 | Popular Tags |