org.eclipse.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" ); pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() ); request.addArtifact( pomArtifact );
/** * 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 ) { this.mainArtifact = requireNonNull( mainArtifact, "main artifact cannot be null" ); this.classifier = classifier; this.extension = extension; this.file = file; this.properties = copyProperties( properties ); }
java.nio.file.Files.write(target, result.getBytes()); pom = new SubArtifact(jarArtifact, null, "pom").setFile(target.toFile()); } catch (final Exception ex) { pom = null;
public String getExtension() { return expand( extension, mainArtifact.getExtension() ); }
java.nio.file.Files.write(target, result.getBytes()); pom = new SubArtifact(jarArtifact, null, "pom").setFile(target.toFile()); } catch (final Exception ex) { pom = null;
public String getClassifier() { return expand( classifier, mainArtifact.getClassifier() ); }
org.eclipse.aether.artifact.Artifact pomArtifact = new SubArtifact( mainArtifact, "", "pom" ); pomArtifact = pomArtifact.setFile( ( (ProjectArtifactMetadata) metadata ).getFile() ); request.addArtifact( pomArtifact );
public String getClassifier() { return expand( classifier, mainArtifact.getClassifier() ); }
/** * 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 = copyProperties( properties ); }
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 ); }
public String getExtension() { return expand( extension, mainArtifact.getExtension() ); }
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 ); }
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 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 ); }
installReq.addArtifact(artifact); if (pomFile != null && Files.exists(pomFile.toPath())) { Artifact pomArtifact = new SubArtifact(artifact, "", "pom"); pomArtifact = pomArtifact.setFile(pomFile); installReq.addArtifact(pomArtifact);
installReq.addArtifact(artifact); if (pomFile != null && Files.exists(pomFile.toPath())) { Artifact pomArtifact = new SubArtifact(artifact, "", "pom"); pomArtifact = pomArtifact.setFile(pomFile); installReq.addArtifact(pomArtifact);
public static void main( String[] args ) throws Exception { System.out.println( "------------------------------------------------------------" ); System.out.println( InstallArtifacts.class.getSimpleName() ); RepositorySystem system = Booter.newRepositorySystem(); RepositorySystemSession session = Booter.newRepositorySystemSession( system ); Artifact jarArtifact = new DefaultArtifact( "test", "org.eclipse.aether.examples", "", "jar", "0.1-SNAPSHOT" ); jarArtifact = jarArtifact.setFile( new File( "src/main/data/demo.jar" ) ); Artifact pomArtifact = new SubArtifact( jarArtifact, "", "pom" ); pomArtifact = pomArtifact.setFile( new File( "pom.xml" ) ); InstallRequest installRequest = new InstallRequest(); installRequest.addArtifact( jarArtifact ).addArtifact( pomArtifact ); system.install( session, installRequest ); }
public static void main( String[] args ) throws Exception { System.out.println( "------------------------------------------------------------" ); System.out.println( DeployArtifacts.class.getSimpleName() ); RepositorySystem system = Booter.newRepositorySystem(); RepositorySystemSession session = Booter.newRepositorySystemSession( system ); Artifact jarArtifact = new DefaultArtifact( "test", "org.eclipse.aether.examples", "", "jar", "0.1-SNAPSHOT" ); jarArtifact = jarArtifact.setFile( new File( "src/main/data/demo.jar" ) ); Artifact pomArtifact = new SubArtifact( jarArtifact, "", "pom" ); pomArtifact = pomArtifact.setFile( new File( "pom.xml" ) ); RemoteRepository distRepo = new RemoteRepository.Builder( "org.eclipse.aether.examples", "default", new File( "target/dist-repo" ).toURI().toString() ).build(); DeployRequest deployRequest = new DeployRequest(); deployRequest.addArtifact( jarArtifact ).addArtifact( pomArtifact ); deployRequest.setRepository( distRepo ); system.deploy( session, deployRequest ); }
public void installAndDeploy() throws InstallationException, DeploymentException { Aether aether = new Aether( "http://localhost:8081/nexus/content/groups/public", "/Users/jvanzyl/aether-repo" ); Artifact artifact = new DefaultArtifact( "com.mycompany.super", "super-core", "jar", "0.1-SNAPSHOT" ); artifact = artifact.setFile( new File( "jar-from-whatever-process.jar" ) ); Artifact pom = new SubArtifact( artifact, null, "pom" ); pom = pom.setFile( new File( "pom-from-whatever-process.xml" ) ); // Install into the local repository specified // aether.install( artifact, pom ); // Deploy to a remote reposistory // aether.deploy( artifact, pom, "http://localhost:8081/nexus/content/repositories/snapshots/" ); }
Artifact pomXMLArtifact = new SubArtifact(jarArtifact, "", "pom");