@Override public int compare(DependencyRelationship o1, DependencyRelationship o2) { ArtifactRef target1 = o1.getTarget(); ArtifactRef target2 = o2.getTarget(); int ret = target1.getGroupId().compareTo(target2.getGroupId()); if (ret == 0) { ret = target1.getArtifactId().compareTo(target2.getArtifactId()); } if (ret == 0) { ret = DummyVersionComparator.compareVersions(target1.getVersionString(), target2.getVersionString()); } if (ret == 0) { String class1 = target1.getClassifier() == null ? "" : target1.getClassifier(); String class2 = target2.getClassifier() == null ? "" : target2.getClassifier(); ret = class1.compareTo(class2); } if (ret == 0) { ret = target1.getType().compareTo(target2.getType()); } return ret; }
public void addArtifactRef( final ArtifactRef ref ) { addVersionRef( ref.asProjectVersionRef() ); artifactRefs.add( ref ); }
public SimpleVersionlessArtifactRef( final ArtifactRef ref ) { super( ref.getGroupId(), ref.getArtifactId() ); this.tc = ref.getTypeAndClassifier(); }
private static void toRelationshipProperties( final ArtifactRef target, final Relationship relationship ) { Logger logger = LoggerFactory.getLogger( Conversions.class ); logger.debug( "Type of artifact: {} (type: {}) is: {}", target, target.getClass().getSimpleName(), target.getType() ); relationship.setProperty( TYPE, target.getType() ); if ( target.getClassifier() != null ) { relationship.setProperty( CLASSIFIER, target.getClassifier() ); } }
public static ArtifactRef newNeoArtifactRef( final ProjectVersionRef ref, final ArtifactRef target ) { NeoTypeAndClassifier tc; if ( target instanceof NeoArtifactRef ) { tc = (NeoTypeAndClassifier) target.getTypeAndClassifier(); } else { tc = new NeoTypeAndClassifier( target.getType(), target.getClassifier() ); } return new NeoArtifactRef( ref, tc ); }
if ( ar.isVariableVersion() ) ar.asProjectVersionRef() ); new SimpleArtifactRef( ar.getGroupId(), ar.getArtifactId(), specific.getVersionSpec(), ar.getType(), ar.getClassifier() ); if ( !"pom".equals( ar.getType() ) ) pomAR = ar.asPomArtifact(); try tcs = artifacts.listAvailableArtifacts( resolvedLocation, ar.asProjectVersionRef() ); new SimpleArtifactRef( ar.getGroupId(), ar.getArtifactId(), ar.getVersionSpec(), extraCT.getType(), extraCT.getClassifier() ); final String type = ref.getType(); final int idx = type.lastIndexOf( '.' ); if ( idx > 0 ) if ( ref.getType() .endsWith( meta ) ) final ArtifactRef metaAR = ref.asArtifactRef( ref.getType() + "." + meta, ref.getClassifier() );
@Override public boolean isBOM() { return DependencyScope._import == getScope() && "pom".equals( getTargetArtifact().getType() ); }
public static Set<ArtifactRef> collectArtifactReferences( final Collection<ProjectRelationship<?, ?>> rels, final boolean includePomArtifacts ) { final Set<ArtifactRef> artifacts = new HashSet<ArtifactRef>(); for ( final ProjectRelationship<?, ?> rel : rels ) { // if ( !( rel instanceof DependencyRelationship ) ) // { // continue; // } if ( includePomArtifacts ) { final ProjectVersionRef pvr = rel.getDeclaring() .asProjectVersionRef(); artifacts.add( pvr.asPomArtifact() ); } final ArtifactRef tar = rel.getTargetArtifact(); artifacts.add( tar ); if ( includePomArtifacts ) { artifacts.add( tar.asPomArtifact() ); } } return artifacts; }
final ProjectRef tr = tar.asProjectRef(); ProjectRefCollection tprc = projects.get( tr ); if ( tprc == null )
if ( ar.isVariableVersion() ) ar.asProjectVersionRef() ); new SimpleArtifactRef( ar.getGroupId(), ar.getArtifactId(), specific.getVersionSpec(), ar.getType(), ar.getClassifier() ); if ( !"pom".equals( ar.getType() ) ) pomAR = ar.asPomArtifact(); try tcs = artifacts.listAvailableArtifacts( resolvedLocation, ar.asProjectVersionRef() ); new SimpleArtifactRef( ar.getGroupId(), ar.getArtifactId(), ar.getVersionSpec(), extraCT.getType(), extraCT.getClassifier() ); final String type = ref.getType(); final int idx = type.lastIndexOf( '.' ); if ( idx > 0 ) if ( ref.getType() .endsWith( meta ) ) final ArtifactRef metaAR = ref.asArtifactRef( ref.getType() + "." + meta, ref.getClassifier() );
if ( comp == 0 ) final String fc = f.getClassifier(); final String sc = s.getClassifier(); final String ft = f.getType(); // never null final String st = s.getType(); // never null
public NeoVersionlessArtifactRef( final ArtifactRef ref ) { super( ref.getGroupId(), ref.getArtifactId() ); this.tc = ref.getTypeAndClassifier(); }
@Override public boolean isBOM() { return DependencyScope._import == getScope() && "pom".equals( getTargetArtifact().getType() ); }
public static Set<ArtifactRef> collectArtifactReferences( final Collection<ProjectRelationship<?, ?>> rels, final boolean includePomArtifacts ) { final Set<ArtifactRef> artifacts = new HashSet<ArtifactRef>(); for ( final ProjectRelationship<?, ?> rel : rels ) { // if ( !( rel instanceof DependencyRelationship ) ) // { // continue; // } if ( includePomArtifacts ) { final ProjectVersionRef pvr = rel.getDeclaring() .asProjectVersionRef(); artifacts.add( pvr.asPomArtifact() ); } final ArtifactRef tar = rel.getTargetArtifact(); artifacts.add( tar ); if ( includePomArtifacts ) { artifacts.add( tar.asPomArtifact() ); } } return artifacts; }
final ProjectRef tr = tar.asProjectRef(); ProjectRefCollection tprc = projects.get( tr ); if ( tprc == null )
private static void compareDependencies( Type type, boolean reportNonAligned, Set<ArtifactRef> originalDeps, Set<ArtifactRef> newDeps ) { Set<ArtifactRef> nonAligned = new HashSet<>( ); originalDeps.forEach( originalArtifact -> newDeps.stream().filter( newArtifact -> ( newArtifact.getGroupId().equals( originalArtifact.getGroupId() ) && newArtifact.getArtifactId().equals( originalArtifact.getArtifactId() ) && newArtifact.getType().equals( originalArtifact.getType() ) && StringUtils.equals(newArtifact.getClassifier(), originalArtifact.getClassifier() ) ) ).forEach( newArtifact -> { if ( ! newArtifact.getVersionString().equals( originalArtifact.getVersionString() ) ) { logger.info( "\t{} : {} --> {} ", type, originalArtifact, newArtifact ); } else if ( reportNonAligned ) { nonAligned.add( originalArtifact ); } } ) ); if ( nonAligned.size() > 0 ) { logger.info( "" ); nonAligned.forEach( na -> logger.info( "\tNon-Aligned {} : {} ", type, na ) ); } }
@Override public DependencyRelationship selectTarget( final ProjectVersionRef ref ) { final ProjectVersionRef d = getDeclaring(); ArtifactRef t = getTarget(); t = (ArtifactRef) ( ( ref instanceof ArtifactRef ) ? ref : new SimpleArtifactRef( ref, t.getType(), t.getClassifier() ) ); Set<ProjectRef> var = getExcludes(); return new SimpleDependencyRelationship( getSources(), getPomLocation(), d, t, getScope(), getIndex(), isManaged(), isInherited(), optional, var.toArray( new ProjectRef[var.size()] ) ); }
if ( refs.size() > 1 && "pom".equals( ar.getType() ) )
public void addArtifactRef( final ArtifactRef ref ) { addVersionRef( ref.asProjectVersionRef() ); artifactRefs.add( ref ); }
@Override public PluginDependencyRelationship selectTarget( final ProjectVersionRef ref ) { final ProjectVersionRef d = getDeclaring(); ArtifactRef t = getTarget(); t = (ArtifactRef) ( ( ref instanceof ArtifactRef ) ? ref : new SimpleArtifactRef( ref, t.getType(), t.getClassifier() ) ); return new SimplePluginDependencyRelationship( getSources(), getPomLocation(), d, getPlugin(), t, getIndex(), isManaged(), isInherited() ); }