private Artifact getArtifactFromPomProperties(String type, Properties pomProps) { return new DefaultArtifact( pomProps.getProperty("groupId"), pomProps.getProperty("artifactId"), pomProps.getProperty("version"), "runtime", type, pomProps.getProperty("classifier", ""), new DefaultArtifactHandler(type) ); }
public Artifact create( MavenProject project ) { ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler( project.getPackaging() ); return new DefaultArtifact( project.getGroupId(), project.getArtifactId(), VersionRange.createFromVersion( project.getVersion() ), null, project.getPackaging(), null, handler, false ); }
public Artifact create( MavenProject project, String type, String classifier, boolean optional ) { ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler( type ); return new DefaultArtifact( project.getGroupId(), project.getArtifactId(), VersionRange.createFromVersion( project.getVersion() ), null, project.getPackaging(), null, handler, optional ); }
return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler, optional );
return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, classifier, handler, optional );
public static org.apache.maven.artifact.Artifact toArtifact( Artifact artifact ) { if ( artifact == null ) { return null; } ArtifactHandler handler = newHandler( artifact ); /* * NOTE: From Artifact.hasClassifier(), an empty string and a null both denote "no classifier". However, some * plugins only check for null, so be sure to nullify an empty classifier. */ org.apache.maven.artifact.Artifact result = new org.apache.maven.artifact.DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), null, artifact.getProperty( ArtifactProperties.TYPE, artifact.getExtension() ), nullify( artifact.getClassifier() ), handler ); result.setFile( artifact.getFile() ); result.setResolved( artifact.getFile() != null ); List<String> trail = new ArrayList<>( 1 ); trail.add( result.getId() ); result.setDependencyTrail( trail ); return result; }
DefaultArtifact clone = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), range.cloneOf(), artifact.getScope(), artifact.getType(), artifact.getClassifier(), artifact.getArtifactHandler(), artifact.isOptional() );
DefaultArtifact clone = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), range.cloneOf(), artifact.getScope(), artifact.getType(), artifact.getClassifier(), artifact.getArtifactHandler(), artifact.isOptional() );
/** * @param groupId not null * @param artifactId not null * @param versionRange not null * @param scope not null * @param type not null * @param classifier * @param optional not null * @return a <code>DefaultArtifact</code> instance * @throws IOException if any */ public Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type, String classifier, boolean optional ) throws IOException { ArtifactHandler ah = new DefaultArtifactHandlerStub( type, classifier ); Artifact artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, classifier, ah, optional ); // i have no idea why this needs to be done manually when isSnapshot is able to figure it out. artifact.setRelease( !artifact.isSnapshot() ); if ( createFiles ) { setArtifactFile( artifact, this.workingDir, this.srcFile, this.createUnpackableFile ); } return artifact; }
private Artifact getArtifactFromPomProperties(String type, Properties pomProps) { return new DefaultArtifact( pomProps.getProperty("groupId"), pomProps.getProperty("artifactId"), pomProps.getProperty("version"), "runtime", type, pomProps.getProperty("classifier", ""), new DefaultArtifactHandler(type) ); }
private void attachIfNeeded(File jar) { if (jar.isFile() && classifier != null && attach) { ArtifactHandler handler = new DefaultArtifactHandler("jar"); Artifact vertxJarArtifact = new DefaultArtifact(project.getGroupId(), project.getArtifactId(), project.getVersion(), "compile", "jar", classifier, handler); vertxJarArtifact.setFile(jar); this.project.addAttachedArtifact(vertxJarArtifact); } }
Artifact createArtifact(File file, String groupId, String artifactId, String version, String scope, String type, String classifier) { DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, version, scope, type, classifier, artifactHandler); artifact.setFile(file); artifact.setResolved(true); return artifact; }
public static Artifact resolveArtifactFile(MavenSession session, RepositorySystem repository, String groupId, String artifactId, String version, String type) { final DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, version, "compile", type, "", new DefaultArtifactHandler(type)); final ArtifactResolutionResult result = resolveArtifact(session, repository, artifact, false, null); for (Artifact a : result.getArtifacts()) { if (a.equals(artifact)) { return a; } } throw new IllegalArgumentException(artifact + " could not be resolved"); }
public static org.apache.maven.artifact.Artifact aetherToMavenArtifactBasic(Artifact artifact) { DefaultArtifact mavenArtifact = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), "compile", artifact.getExtension(), artifact.getClassifier(), null); return mavenArtifact; }
private static Artifact createMockArtifact( final String groupId, final String artifactId, final String versionRange, final String scope, final String type, final String classifier ) { ArtifactHandler artifactHandler = new DefaultArtifactHandler(); VersionRange version = VersionRange.createFromVersion( versionRange ); return new DefaultArtifact( groupId, artifactId, version, scope, type, classifier, artifactHandler ); } }
private File getArtifactFile(ArtifactRevisionIdentifier id, MavenProject mavenProject) { id = applyRelocation(id, mavenProject); org.apache.maven.artifact.Artifact mainArtifact = mavenProject.getArtifact(); //add classifier.. ArtifactHandler artifactHandler = new MyArtifactHandler(mainArtifact.getArtifactHandler()); mainArtifact = new DefaultArtifact(id.getArtifactIdentifier().getGroupId(), id.getArtifactIdentifier().getArtifactId(), VersionRange.createFromVersion(id.getVersion()), mainArtifact.getScope(), mainArtifact.getType(), id.getClassifier(), artifactHandler); String relativePath = localRepository.pathOf(mainArtifact); return new File(localRepository.getBasedir(), relativePath); }
private Artifact toMavenArtifact(org.eclipse.aether.graph.Dependency dependency) { org.eclipse.aether.artifact.Artifact sa = dependency.getArtifact(); Artifact a = new DefaultArtifact(sa.getGroupId(), sa.getArtifactId(), sa.getVersion(), dependency.getScope(), sa.getExtension(), sa.getClassifier(), artifactHandler); return a; }
private File getDependencyFile(ComponentDependency dep) { ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler(dep.getType()); Artifact artifact = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getVersion(), null, dep.getType(), null, artifactHandler); return getArtifactFile(artifact); }
@Override public org.apache.maven.artifact.Artifact apply(org.eclipse.aether.artifact.Artifact a) { return new DefaultArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion(), "compile", a.getExtension(), a.getClassifier() != null ? a.getClassifier() : null, new DefaultArtifactHandler()); } }
@Override public org.apache.maven.artifact.Artifact apply(org.eclipse.aether.artifact.Artifact a) { return new DefaultArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion(), "compile", a.getExtension(), a.getClassifier() != null ? a.getClassifier() : null, new DefaultArtifactHandler()); } }