public Artifact setFile( File file ) { if ( ( this.file == null ) ? file == null : this.file.equals( file ) ) { return this; } return new SubArtifact( mainArtifact, classifier, extension, file, properties ); }
/** * Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk * character "*" to refer to the corresponding property of the main artifact. For instance, the classifier * "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be * used to refer to the GPG signature of an artifact. * * @param mainArtifact The artifact from which to derive the identity, must not be {@code null}. * @param classifier The classifier for this artifact, may be {@code null} if none. * @param extension The extension for this artifact, may be {@code null} if none. * @param properties The properties of the artifact, may be {@code null}. * @param file The file for this artifact, may be {@code null} if unresolved. */ public SubArtifact( Artifact mainArtifact, String classifier, String extension, Map<String, String> properties, File file ) { if ( mainArtifact == null ) { throw new IllegalArgumentException( "no artifact specified" ); } this.mainArtifact = mainArtifact; this.classifier = classifier; this.extension = extension; this.file = file; this.properties = copy( properties ); }
public String getClassifier() { return expand( classifier, mainArtifact.getClassifier() ); }
public Artifact setVersion( String version ) { return new DefaultArtifact( getGroupId(), getArtifactId(), getClassifier(), getExtension(), version, getFile(), getProperties() ); }
public Artifact setProperties( Map<String, String> properties ) { if ( this.properties.equals( properties ) || ( properties == null && this.properties.isEmpty() ) ) { return this; } return new SubArtifact( mainArtifact, classifier, extension, properties, file ); }
public String getExtension() { return expand( extension, mainArtifact.getExtension() ); }
/** * Installs the given artifact and all its transitive dependencies */ public GAV install(GAV gav, File jar, File pom) throws Exception { Artifact jarArtifact = toArtifact(gav); jarArtifact = jarArtifact.setFile(jar); Artifact pomArtifact = new SubArtifact(jarArtifact, "", "pom"); pomArtifact = pomArtifact.setFile(pom); InstallRequest installRequest = new InstallRequest(); installRequest.addArtifact(jarArtifact).addArtifact(pomArtifact); rs.install(session, installRequest); return install(gav); }
Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" ); pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() ); request.addArtifact( pomArtifact );
Artifact pomArtifact = new SubArtifact( aetherArtifact, "", "pom" ); pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() ); request.addArtifact( pomArtifact );