public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ) { return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier ); }
if ( artifact.getClassifier() != null ) result = artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier() );
public Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier ) { return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier ); }
private File resolveArtifact( String groupId, String artifactId, String version, String type, String classifier, ArtifactRepository localRepository, List<ArtifactRepository> repositories ) throws ArtifactResolutionException, IOException, ArtifactNotFoundException { // TODO: this is a bit crude - proper type, or proper handling as metadata rather than an artifact in 2.1? Artifact artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier ); artifactResolver.resolve( artifact, repositories, localRepository ); return artifact.getFile(); }
protected Artifact resolveScreenshotArtifact(final Artifact artifact, final String version) throws ArtifactResolutionException, ArtifactNotFoundException { // resolve screenshots.zip artifact Artifact resolveArtifact = artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(), version, "zip", "screenshots"); artifactResolver.resolve(resolveArtifact, remoteArtifactRepositories, localRepository); return resolveArtifact; } }
private Artifact createResourceArtifact( final Artifact artifact, final String classifier, final SourceResolverConfig config ) { final DefaultArtifact a = (DefaultArtifact) artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), "jar", classifier ); a.setRepository( artifact.getRepository() ); return a; }
private List<Artifact> getAlternateClassPath() throws MojoExecutionException { List<Artifact> result = new ArrayList<Artifact>(); for (Dependency dependency : alternativeClasspath) { Artifact artifact = artifactFactory.createArtifactWithClassifier(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), "jar", dependency.getClassifier()); try { resolver.resolve(artifact, remoteRepositories, localRepository); } catch (Exception e) { throw new MojoExecutionException("Error resolving artifact: " + artifact, e); } result.add(artifact); } return result; }
protected File resolve(ArtifactInfo a, String type, String classifier) throws AbstractArtifactResolutionException { Artifact artifact = af.createArtifactWithClassifier(a.groupId, a.artifactId, a.version, type, classifier); if (!new File(localRepo, local.pathOf(artifact)).isFile()) { System.err.println("Downloading " + artifact); } try { ar.resolve(artifact, remoteRepositories, local); } catch (RuntimeException e) { throw new ArtifactResolutionException(e.getMessage(), artifact); } return artifact.getFile(); }
private void copyArtifact( Artifact artifact ) throws MojoExecutionException { copyPoms( artifact ); Artifact depArtifact = artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), artifact.getType(), artifact.getClassifier() ); File artifactFile = artifact.getFile(); copyArtifact( artifactFile, depArtifact ); }
@SuppressWarnings("deprecation") private void archive(String type) throws IOException { Artifact artifact1 = factory.createArtifactWithClassifier(project.getArtifact().getGroupId(), project.getArtifact().getArtifactId(), project.getArtifact().getVersion(), type, "bin"); File target1 = archive(targetServerDirectory, destDir, artifact1); // artifact1 is created with explicit classifier "bin", which is dropped below when attachArtifact is called // which means we can't use artifact1.equals(artifact) directly with artifact1 Artifact artifact2 = factory.createArtifact(artifact1.getGroupId(), artifact1.getArtifactId(), artifact1.getVersion(), artifact1.getScope(), artifact1.getType()); for (Artifact artifact : project.getAttachedArtifacts()) { if (artifact2.equals(artifact)) { getLog().debug("Artifact " + artifact2 + " already attached"); return; } } if (attach) { projectHelper.attachArtifact(project, artifact1.getType(), classifier, target1); } if (!project.getPackaging().equals("pom")) { artifact2.setFile(target1); project.setArtifact(artifact2); } }
protected Artifact resolve( String groupId, String artifactId, String version, String type, String classifier ) throws MojoExecutionException { // return project.getArtifactMap().get( groupId + ":" + artifactId ); Artifact artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier ); try { resolver.resolve(artifact, remoteRepositories, localRepository); } catch ( ArtifactNotFoundException e ) { throw new MojoExecutionException( "artifact not found - " + e.getMessage(), e ); } catch ( ArtifactResolutionException e ) { throw new MojoExecutionException( "artifact resolver problem - " + e.getMessage(), e ); } return artifact; }
@SuppressWarnings("deprecation") private void archive(String type) throws IOException { Artifact artifact1 = factory.createArtifactWithClassifier(project.getArtifact().getGroupId(), project.getArtifact().getArtifactId(), project.getArtifact().getVersion(), type, "bin"); File target1 = archive(targetServerDirectory, destDir, artifact1); // artifact1 is created with explicit classifier "bin", which is dropped below when attachArtifact is called // which means we can't use artifact1.equals(artifact) directly with artifact1 Artifact artifact2 = factory.createArtifact(artifact1.getGroupId(), artifact1.getArtifactId(), artifact1.getVersion(), artifact1.getScope(), artifact1.getType()); for (Artifact artifact : project.getAttachedArtifacts()) { if (artifact2.equals(artifact)) { getLog().debug("Artifact " + artifact2 + " already attached"); return; } } if (attach) { projectHelper.attachArtifact(project, artifact1.getType(), classifier, target1); } artifact2.setFile(target1); project.setArtifact(artifact2); }
/** * Modify main artifact to add a "clover" classifier to it so that it's not mixed with the main artifact of * a normal build. */ private void redirectArtifact() { // Only redirect main artifact for non-pom projects if ( !getProject().getPackaging().equals( "pom" ) ) { Artifact oldArtifact = getProject().getArtifact(); Artifact newArtifact = this.artifactFactory.createArtifactWithClassifier( oldArtifact.getGroupId(), oldArtifact.getArtifactId(), oldArtifact.getVersion(), oldArtifact.getType(), "clover" ); getProject().setArtifact( newArtifact ); getProject().getBuild().setFinalName( getProject().getArtifactId() + "-" + getProject().getVersion() + "-clover" ); } }
protected Artifact resolve( String groupId, String artifactId, String version, String type, String classifier ) throws MojoExecutionException { // return project.getArtifactMap().get( groupId + ":" + artifactId ); Artifact artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier ); try { resolver.resolve(artifact, remoteRepositories, localRepository); } catch ( ArtifactNotFoundException e ) { throw new MojoExecutionException( "artifact not found - " + e.getMessage(), e ); } catch ( ArtifactResolutionException e ) { throw new MojoExecutionException( "artifact resolver problem - " + e.getMessage(), e ); } return artifact; }
/** * Will download the specified artifact in the specified directory. * @see org.apache.maven.plugin.Mojo#execute() */ public void execute() throws MojoExecutionException, MojoFailureException { if (this.skip) { getLog().info("maven-download-plugin:artifact skipped"); return; } if (this.dependencyDepth > 0 && this.outputFileName != null) { throw new MojoFailureException("Cannot have a dependency depth higher than 0 and an outputFileName"); } org.apache.maven.artifact.Artifact artifact = artifactFactory.createArtifactWithClassifier(groupId, artifactId, version, type, classifier); downloadAndAddArtifact(artifact, dependencyDepth); for (org.apache.maven.artifact.Artifact copy : this.artifactToCopy) { if (this.unpack) { this.unpackFileToDirectory(copy); } else { this.copyFileToDirectory(copy); } } }
protected Artifact resolveArtifact(Dependency dependency) throws Exception { Artifact artifact = null; if (Validator.isNull(dependency.getClassifier())) { artifact = artifactFactory.createArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), dependency.getScope(), dependency.getType()); } else { artifact = artifactFactory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), dependency.getType(), dependency.getClassifier()); } artifactResolver.resolve( artifact, remoteArtifactRepositories, localArtifactRepository); return artifact; }
public Artifact createArtifactWithClassifier(String groupId, String artifactId, String version, String type, String classifier) { return createFromOriginal(original.createArtifactWithClassifier(checkValue(groupId), checkValue(artifactId), checkVersion(version), type, classifier)); }
public Artifact createArtifactWithClassifier(String groupId, String artifactId, String version, String type, String classifier) { return createFromOriginal(original.createArtifactWithClassifier(checkValue(groupId), checkValue(artifactId), checkVersion(version), type, classifier)); }
private Set<Artifact> resolveArtifact(Dependency dependency, MavenParameters mavenParameters, boolean transitively, PluginParameters pluginParameters, ConfigurationVersion configurationVersion) throws MojoFailureException { notNull(mavenParameters.getArtifactRepositories(), "Maven parameter artifactRepositories should be provided by maven container."); Artifact artifact = mavenParameters.getArtifactFactory().createArtifactWithClassifier(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), dependency.getType(), dependency.getClassifier()); return resolveArtifact(artifact, mavenParameters, transitively, pluginParameters, configurationVersion); }
/** * Creates an artifact using information from the specified project. * * @param project a project to use as the source of the returned artifact * @param artifactFactory artifact factory used to create the artifact * @param localRepository the local repository * @return an artifact using information from the specified project */ public static Artifact createArtifactFrom( Project project, ArtifactFactory artifactFactory, File localRepository ) { logAndVerifyProjectParameters( project ); Artifact assembly = artifactFactory.createArtifactWithClassifier( project.getGroupId(), project.getArtifactId(), project.getVersion(), project.getArtifactType(), project.getPublicKeyTokenId() ); File artifactFile = ( ( ArtifactTypeHelper.isDotnetAnyGac( project.getArtifactType() ) ) ) ? PathUtil.getGlobalAssemblyCacheFileFor( assembly, localRepository) : PathUtil.getDotNetArtifact( assembly, localRepository ) ; assembly.setFile( artifactFile ); return assembly; }