@Override public int compare( final ProjectVersionRef f, final ProjectVersionRef s ) { final int comp = f.compareTo( s ); // this compares groupId and artifactId ONLY if ( comp == 0 ) { final VersionSpec fs = f.getVersionSpec(); final VersionSpec ss = s.getVersionSpec(); return fs.compareTo( ss ); } return comp; }
private VersionSpec generateVersionSpec( final Set<ProjectVersionRef> refs, final boolean generateVersionRanges ) { final List<VersionSpec> versions = new ArrayList<>(); for ( final ProjectVersionRef ref : refs ) { final VersionSpec spec = ref.getVersionSpec(); versions.add( spec ); } Collections.sort( versions ); if ( !generateVersionRanges || versions.size() == 1 ) { return versions.get( 0 ); } return new CompoundVersionSpec( null, versions ); }
private VersionSpec generateVersionSpec( final Set<ProjectVersionRef> refs, final boolean generateVersionRanges ) { final List<VersionSpec> versions = new ArrayList<>(); for ( final ProjectVersionRef ref : refs ) { final VersionSpec spec = ref.getVersionSpec(); versions.add( spec ); } Collections.sort( versions ); if ( !generateVersionRanges || versions.size() == 1 ) { return versions.get( 0 ); } return new CompoundVersionSpec( null, versions ); }
@Override public GraphPath<?> createPath( final GraphPath<?> parent, final ProjectRelationship<?, ?> child ) { try { child.getTarget() .getVersionSpec(); } catch ( final InvalidVersionSpecificationException e ) { return null; } if ( parent != null && !( parent instanceof JungGraphPath ) ) { throw new IllegalArgumentException( "Cannot get child path for: " + parent + ". This is not a JungGraphPath instance!" ); } return new JungGraphPath( (JungGraphPath) parent, child ); }
@Override public GraphPath<?> createPath( final ProjectRelationship<?, ?>... rels ) { if ( rels.length > 0 ) { try { rels[rels.length - 1].getTarget() .getVersionSpec(); } catch ( final InvalidVersionSpecificationException e ) { return null; } } return new JungGraphPath( rels ); }
private void initLocalRepo(GalleyMaven galley, Path scmDir) throws IOException { Set<Path> poms = getAllPoms(scmDir); for (Path pomFile : poms) { PomPeek peek = new PomPeek(pomFile.toFile()); final ProjectVersionRef key = peek.getKey(); if (key == null) { log.warn("Could not parse " + pomFile.toAbsolutePath()); continue; } try { String artifactPath = ArtifactPathUtils.formatArtifactPath(key.asPomArtifact(), galley.getTypeMapper()); Path p = path.resolve(artifactPath); Files.createDirectories(p.getParent()); if (key.getVersionSpec().isSnapshot()) { initSnapshot(key, pomFile, p); } else { Files.copy(pomFile, p); } } catch (TransferException | RuntimeException ex) { log.warn("Could not parse " + pomFile.toAbsolutePath(), ex); } catch (FileAlreadyExistsException ex) { log.error("File already exists. This is because there are multiple file with same " + "GAV. This ususaly happens when there are pom files in tests and is " + "harmless in this case.", ex); } } }
if ( other.getVersionSpec() != null ) else if ( !getVersionSpec().equals( other.getVersionSpec() ) )
if ( other.getVersionSpec() != null ) else if ( !getVersionSpec().equals( other.getVersionSpec() ) )
new SimpleArtifactRef( ar.getGroupId(), ar.getArtifactId(), specific.getVersionSpec(), ar.getType(), ar.getClassifier() );
new SimpleArtifactRef( ar.getGroupId(), ar.getArtifactId(), specific.getVersionSpec(), ar.getType(), ar.getClassifier() );
if ( target.isVariableVersion() || !target.getVersionSpec() .isSingle() )
model.setGroupId( pomCoord.getGroupId() ); model.setArtifactId( pomCoord.getArtifactId() ); model.setVersion( pomCoord.getVersionSpec().renderStandard() ); model.setPackaging( "pom" ); model.setDescription( "Generated by Cartographer at " + new Date() );
model.setGroupId( pomCoord.getGroupId() ); model.setArtifactId( pomCoord.getArtifactId() ); model.setVersion( pomCoord.getVersionSpec().renderStandard() ); model.setPackaging( "pom" ); model.setDescription( "Generated by Cartographer at " + new Date() );