public String toMetadataPath( VersionedReference reference ) { StringBuffer path = new StringBuffer(); path.append( formatAsDirectory( reference.getGroupId() ) ).append( PATH_SEPARATOR ); path.append( reference.getArtifactId() ).append( PATH_SEPARATOR ); if ( reference.getVersion() != null ) { // add the version only if it is present path.append( VersionUtil.getBaseVersion( reference.getVersion() ) ).append( PATH_SEPARATOR ); } path.append( MAVEN_METADATA ); return path.toString(); }
public static String toKey( VersionedReference reference ) { StringBuffer key = new StringBuffer(); key.append( defaultString( reference.getGroupId() ) ).append( ":" ); key.append( defaultString( reference.getArtifactId() ) ).append( ":" ); key.append( defaultString( reference.getVersion() ) ).append( ":" ); return key.toString(); }
public DependencyGraph createGraph( VersionedReference versionedProjectReference ) { String groupId = versionedProjectReference.getGroupId(); String artifactId = versionedProjectReference.getArtifactId(); String version = versionedProjectReference.getVersion(); DependencyGraph graph = new DependencyGraph( groupId, artifactId, version ); return graph; }
public static String toKey( VersionedReference ref ) { return toKey( ref.getGroupId(), ref.getArtifactId(), ref.getVersion() ); } }
private void deleteVersions( File typeDir, VersionedReference reference ) { File repoFiles[] = typeDir.listFiles(); for ( File repoFile : repoFiles ) { if ( repoFile.isDirectory() ) { // Skip it. it's a directory. continue; } String relativePath = PathUtil.getRelative( repository.getLocation(), repoFile ); if ( filetypes.matchesArtifactPattern( relativePath ) ) { try { ArtifactReference artifact = toArtifactReference( relativePath ); if ( StringUtils.equals( artifact.getArtifactId(), reference.getArtifactId() ) && StringUtils.equals( artifact.getVersion(), reference.getVersion() ) ) { repoFile.delete(); deleteSupportFiles( repoFile ); } } catch ( LayoutException e ) { /* don't fail the process if there is a bad artifact within the directory. */ } } } }
private void getVersionedVersions( File typeDir, VersionedReference reference, Set<String> foundVersions ) { for ( File repoFile : typeDir.listFiles() ) { if ( repoFile.isDirectory() ) { // Skip it. it's a directory. continue; } String relativePath = PathUtil.getRelative( repository.getLocation(), repoFile ); if ( filetypes.matchesArtifactPattern( relativePath ) ) { try { ArtifactReference artifact = toArtifactReference( relativePath ); if ( StringUtils.equals( artifact.getArtifactId(), reference.getArtifactId() ) && artifact.getVersion().startsWith( reference.getVersion() ) ) { foundVersions.add( artifact.getVersion() ); } } catch ( LayoutException e ) { /* don't fail the process if there is a bad artifact within the directory. */ } } } }
public static VersionedReference clone( VersionedReference versionedReference ) { if ( versionedReference == null ) { return null; } VersionedReference cloned = new VersionedReference(); cloned.setGroupId( versionedReference.getGroupId() ); cloned.setArtifactId( versionedReference.getArtifactId() ); cloned.setVersion( versionedReference.getVersion() ); return cloned; }
if ( StringUtils.isNotBlank( relocation.getArtifactId() ) ) refTO.setArtifactId( relocation.getArtifactId() );