public String getVersion() { if ( version != null ) { return version; } else { return artifact.getVersion(); } }
private boolean isLegacyCoreArtifact( Artifact artifact ) { String version = artifact.getVersion(); return version != null && version.startsWith( "2." ) && artifact.getArtifactId().startsWith( "maven-" ) && artifact.getGroupId().equals( "org.apache.maven" ); }
/** * Convert {@link Artifact} object to String for printing. * * @param artifact Artifact object * @return String representation of Artifact */ public static String artifactToString(Artifact artifact) { StringBuilder buffer = new StringBuilder(128); buffer.append(artifact.getGroupId()); buffer.append(':').append(artifact.getArtifactId()); buffer.append(':').append(artifact.getExtension()); if (artifact.getClassifier().length() > 0) { buffer.append(':').append(artifact.getClassifier()); } buffer.append(':').append(artifact.getVersion()); return buffer.toString(); }
private boolean attachedArtifactComparison( Artifact requested, Artifact attached ) { // // We are taking as much as we can from the DefaultArtifact.equals(). The requested artifact has no file so // we want to remove that from the comparison. // return requested.getArtifactId().equals( attached.getArtifactId() ) && requested.getGroupId().equals( attached.getGroupId() ) && requested.getVersion().equals( attached.getVersion() ) && requested.getExtension().equals( attached.getExtension() ) && requested.getClassifier().equals( attached.getClassifier() ); }
@Override public Model findModel( Artifact artifact ) { String projectKey = ArtifactUtils.key( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ); MavenProject project = projectsByGAV.get( projectKey ); return project == null ? null : project.getModel(); }
public static Artifact toPomArtifact( Artifact artifact ) { Artifact pomArtifact = artifact; if ( pomArtifact.getClassifier().length() > 0 || !"pom".equals( pomArtifact.getExtension() ) ) { pomArtifact = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), "pom", artifact.getVersion() ); } return pomArtifact; }
public Artifact transformArtifact( Artifact artifact ) { if ( artifact.isSnapshot() && artifact.getVersion().equals( artifact.getBaseVersion() ) ) { Object key = RemoteSnapshotMetadata.getKey( artifact ); RemoteSnapshotMetadata snapshotMetadata = snapshots.get( key ); if ( snapshotMetadata != null ) { artifact = artifact.setVersion( snapshotMetadata.getExpandedVersion( artifact ) ); } } return artifact; }
public boolean accept( DependencyNode node, List<DependencyNode> parents ) { Dependency dependency = node.getDependency(); if ( dependency != null ) { org.eclipse.aether.artifact.Artifact a = dependency.getArtifact(); String key = ArtifactUtils.key( a.getGroupId(), a.getArtifactId(), a.getVersion() ); return !keys.contains( key ); } return false; }
private boolean areAllDependenciesInReactor( Collection<MavenProject> projects, Collection<Dependency> dependencies ) { Set<String> projectKeys = getReactorProjectKeys( projects ); for ( Dependency dependency : dependencies ) { org.eclipse.aether.artifact.Artifact a = dependency.getArtifact(); String key = ArtifactUtils.key( a.getGroupId(), a.getArtifactId(), a.getVersion() ); if ( !projectKeys.contains( key ) ) { return false; } } return true; }
currExtensionDir = new File(currExtensionDir, versionedArtifact.getVersion()); createExtensionDirectory(hadoopCoordinate, currExtensionDir);
classifier = artifact.getClassifier(); extension = artifact.getExtension(); version = artifact.getVersion(); localRepo = session.getLocalRepository().getBasedir(); workspace = CacheUtils.getWorkspace( session );
public File findArtifact( Artifact artifact ) { String projectKey = ArtifactUtils.key( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ); MavenProject project = projectsByGAV.get( projectKey ); if ( project != null ) { File file = find( project, artifact ); if ( file == null && project != project.getExecutionProject() ) { file = find( project.getExecutionProject(), artifact ); } return file; } return null; }
try versionConstraint = versionScheme.parseVersionConstraint( request.getArtifact().getVersion() );
String version = artifact.getVersion();
if ( snapshot != null && versioning.getSnapshotVersions().isEmpty() ) String version = artifact.getVersion(); if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 )
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; }
artifact.selectVersion( result.getArtifact().getVersion() ); artifact.setFile( result.getArtifact().getFile() ); artifact.setResolved( true );
artifact.setResolvedVersion( result.getArtifacts().iterator().next().getVersion() );
artifact.selectVersion( pomArtifact.getVersion() ); artifact.setFile( pomFile ); artifact.setResolved( true );
String version = artifact.getVersion();