public Artifact createArtifact( String groupId, String artifactId, String version, String packaging ) { return artifactFactory.createBuildArtifact( groupId, artifactId, version, packaging ); }
Artifact createArtifact( String artifact, String version, String group ) { return artifactFactory.createBuildArtifact( group, artifact, version, "jar" ); }
private Artifact createClusterArtifact( String artifact, String version ) { return artifactFactory.createBuildArtifact( groupIdPrefix + GROUP_CLUSTER, artifact, version, "pom" ); }
/** * Get the artifact which refers to the POM of the executable artifact. * * @param executableArtifact this artifact refers to the actual assembly. * @return an artifact which refers to the POM of the executable artifact. */ private Artifact getExecutablePomArtifact( Artifact executableArtifact ) { return this.artifactFactory.createBuildArtifact( executableArtifact.getGroupId(), executableArtifact.getArtifactId(), executableArtifact.getVersion(), "pom" ); }
/** * Get the artifact which refers to the POM of the executable artifact. * * @param executableArtifact this artifact refers to the actual assembly. * @return an artifact which refers to the POM of the executable artifact. */ private Artifact getExecutablePomArtifact(Artifact executableArtifact) { return this.artifactFactory.createBuildArtifact(executableArtifact.getGroupId(), executableArtifact .getArtifactId(), executableArtifact.getVersion(), "pom"); }
/** * Get the artifact which refers to the POM of the executable artifact. * * @param executableArtifact this artifact refers to the actual assembly. * @return an artifact which refers to the POM of the executable artifact. */ private Artifact getExecutablePomArtifact( Artifact executableArtifact ) { return this.artifactFactory.createBuildArtifact( executableArtifact.getGroupId(), executableArtifact.getArtifactId(), executableArtifact.getVersion(), "pom" ); }
protected Artifact createDummyArtifact() { ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE ); // TODO: maybe not strictly correct, while we should enforce that packaging has a type handler of the same id, we don't return factory.createBuildArtifact( "unspecified", "unspecified", "0.0", "jar" ); }
@Override public void execute() throws MojoExecutionException { updateMavenLib( this.artifactFactory.createBuildArtifact( "commons-io", "commons-io", commonsIoVersion, "jar" ) ); updateMavenLib( this.artifactFactory.createBuildArtifact( "commons-lang", "commons-lang", commonsLangVersion, "jar" ) ); updateMavenLib( this.artifactFactory.createBuildArtifact( "org.jsoup", "jsoup", jsoupVersion, "jar" ) ); }
private ArtifactResolutionResult resolveArtifact( Artifact filteredArtifact, Artifact providerArtifact ) throws ArtifactResolutionException, ArtifactNotFoundException { ArtifactFilter filter = null; if ( filteredArtifact != null ) { filter = new ExcludesArtifactFilter( Collections.singletonList( filteredArtifact.getGroupId() + ":" + filteredArtifact.getArtifactId() ) ); } Artifact originatingArtifact = artifactFactory.createBuildArtifact( "dummy", "dummy", "1.0", "jar" ); return artifactResolver.resolveTransitively( singleton( providerArtifact ), originatingArtifact, localRepository, remoteRepositories, artifactMetadataSource, filter ); }
private String getPluginClasspath() throws ArtifactResolutionException, ArtifactNotFoundException { Set<Artifact> artifacts = new HashSet<Artifact>(1); artifacts.add(pluginDesc.getPluginArtifact()); // we need the dummy artifact here so that maven actually resolves the // plugin's dependencies for us and returns them in the result object Artifact originatingArtifact = artifactFactory.createBuildArtifact( "dummy", "dummy", "1.0", "jar" ); ArtifactResolutionResult result = resolver.resolveTransitively(artifacts, originatingArtifact, remoteRepositories, localRepository, artifactMetadataSource); StringBuilder classpath = new StringBuilder(); for (Object obj : result.getArtifacts()) { Artifact curArtifact = (Artifact)obj; if (classpath.length() > 0) { classpath.append(File.pathSeparatorChar); } classpath.append(curArtifact.getFile().getAbsolutePath()); } return classpath.toString(); } }
private ArtifactResolutionResult resolveArtifact(final Artifact filteredArtifact, final Artifact providerArtifact) throws ArtifactResolutionException, ArtifactNotFoundException { ArtifactFilter filter = null; if (filteredArtifact != null) { filter = new ExcludesArtifactFilter(Collections.singletonList(filteredArtifact.getGroupId() + ":" + filteredArtifact.getArtifactId())); } final Artifact originatingArtifact = this.artifactFactory.createBuildArtifact("dummy", "dummy", "1.0", "jar"); // DUNS, use access method rather than "localRepository" field. return this.artifactResolver.resolveTransitively(Collections.singleton(providerArtifact), originatingArtifact, getLocalRepository(), getRemoteRepositories(), this.metadataSource, filter); }
private Artifact resolveExtAsArtifact(String version, String packaging) throws MojoExecutionException { Artifact toDownload = artifactFactory.createBuildArtifact("net.jangaroo", "ext-as", version, packaging); try { getLog().info("Resolving " + toDownload + "..."); artifactResolver.resolve(toDownload, remoteRepositories, localRepository); return toDownload; } catch (AbstractArtifactResolutionException e) { throw new MojoExecutionException("Couldn't download artifact: " + e.getMessage(), e); } }
public ArtifactHandlerImpl() throws Exception { String id = "org.codehaus.mojo.groovy.runtime:groovy-runtime-loader"; this.base = (Artifact) pluginArtifactMap.get(id); if (base == null) { throw new ProviderException("Missing dependency in the list of plugin artifacts: " + id); } this.template = artifactFactory.createArtifact("org.codehaus.mojo.groovy.runtime", "groovy-runtime-", base.getBaseVersion(), base.getScope(), base.getType()); this.originating = artifactFactory.createBuildArtifact("dummy", "dummy", "1.0", "jar"); }
protected Artifact getArtifact(String groupId, String artifactId, String version, String packaging) { Artifact artifact = factory.createBuildArtifact( groupId, artifactId, version, packaging ); try { resolver.resolve(artifact, remoteRepositories, localRepository); } catch (ArtifactResolutionException | ArtifactNotFoundException e) { getLog().error(getErrorMessage(e)); } return artifact; }
public ArtifactHandlerImpl() throws Exception { String id = "org.codehaus.gmaven.runtime:gmaven-runtime-loader"; Artifact base = (Artifact) pluginArtifactMap.get(id); if (base == null) { throw new ProviderException("Missing dependency in the list of plugin artifacts: " + id); } this.template = artifactFactory.createArtifact("org.codehaus.gmaven.runtime", "gmaven-runtime-", base.getBaseVersion(), base.getScope(), base.getType()); // This is a synthetic artifact, using a reasonable sounding name to avoid confusing users about the dummy artifact this.originating = artifactFactory.createBuildArtifact("org.codehaus.gmaven.runtime", "gmaven-runtime-loader-stub", base.getBaseVersion(), "jar"); }
private ArtifactResolutionResult resolveArtifact( Artifact filteredArtifact, Artifact providerArtifact ) throws ArtifactResolutionException, ArtifactNotFoundException { ArtifactFilter filter = null; if ( filteredArtifact != null ) { filter = new ExcludesArtifactFilter( Collections.singletonList( filteredArtifact.getGroupId() + ":" + filteredArtifact.getArtifactId() ) ); } Artifact originatingArtifact = getArtifactFactory().createBuildArtifact( "dummy", "dummy", "1.0", "jar" ); return getArtifactResolver().resolveTransitively( Collections.singleton( providerArtifact ), originatingArtifact, getLocalRepository(), getRemoteRepositories(), getMetadataSource(), filter ); }
public Artifact createBuildArtifact(String groupId, String artifactId, String version, String packaging) { return createFromOriginal(original.createBuildArtifact(checkValue(groupId), checkValue(artifactId), checkVersion(version), packaging)); }
public Artifact createBuildArtifact(String groupId, String artifactId, String version, String packaging) { return createFromOriginal(original.createBuildArtifact(checkValue(groupId), checkValue(artifactId), checkVersion(version), packaging)); }
protected Artifact createArtifact( Pom pom ) { ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE ); // TODO: maybe not strictly correct, while we should enfore that packaging has a type handler of the same id, we don't return factory.createBuildArtifact( pom.getGroupId(), pom.getArtifactId(), pom.getVersion(), pom.getPackaging() ); }
private void writeRelocationPom( String groupId, String artifactId, String version, String newGroupId, String newArtifactId, String newVersion, String message, ArtifactRepository repository, FileTransaction transaction ) throws IOException { Model pom = new Model(); pom.setGroupId( groupId ); pom.setArtifactId( artifactId ); pom.setVersion( version ); DistributionManagement dMngt = new DistributionManagement(); Relocation relocation = new Relocation(); relocation.setGroupId( newGroupId ); relocation.setArtifactId( newArtifactId ); relocation.setVersion( newVersion ); if ( message != null && message.length() > 0 ) { relocation.setMessage( message ); } dMngt.setRelocation( relocation ); pom.setDistributionManagement( dMngt ); Artifact artifact = artifactFactory.createBuildArtifact( groupId, artifactId, version, "pom" ); //$NON-NLS-1$ Path pomFile = Paths.get( repository.getBasedir(), repository.pathOf( artifact ) ); StringWriter strWriter = new StringWriter(); MavenXpp3Writer pomWriter = new MavenXpp3Writer(); pomWriter.write( strWriter, pom ); transaction.createFile( strWriter.toString(), pomFile, digesters ); }