private boolean isProjectVersion( Path dir ) { final String artifactId = dir.getParent().getFileName().toString(); final String projectVersion = dir.getFileName().toString(); // check if there is a POM artifact file to ensure it is a version directory Predicate<Path> filter; if ( VersionUtil.isSnapshot( projectVersion ) ) { filter = new PomFilenameFilter(artifactId, projectVersion); } else { final String pomFile = artifactId + "-" + projectVersion + ".pom"; filter = new PomFileFilter(pomFile); } try(Stream<Path> stream = Files.list(dir)) { if (stream.filter(Files::isRegularFile).anyMatch(filter)){ return true; } } catch (IOException e) { LOGGER.error("Could not list directory {}: {}", dir, e.getMessage(), e); } // if a metadata file is present, check if this is the "version" directory, marking it as a project version ArchivaRepositoryMetadata metadata = readMetadata( dir ); if ( metadata != null && projectVersion.equals( metadata.getVersion() ) ) { return true; } return false; }
public ArchivaArtifact( ArchivaArtifactModel artifactModel ) { this.model = artifactModel; model.setSnapshot( VersionUtil.isSnapshot( model.getVersion() ) ); this.baseVersion = VersionUtil.getBaseVersion( model.getVersion() ); }
public static boolean isSnapshot( String version ) { Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version ); if ( m.matches() ) { return true; } else { return isGenericSnapshot( version ); } }
metadata.setArtifactId( reference.getArtifactId() ); if ( VersionUtil.isSnapshot( reference.getVersion() ) ) metadata.setVersion( VersionUtil.getBaseVersion( reference.getVersion() ) ); if ( VersionUtil.isUniqueSnapshot( latestVersion ) ) else if ( VersionUtil.isGenericSnapshot( latestVersion ) )
VersionUtil.isSnapshot( artifact.getVersion() ) | VersionUtil.isGenericSnapshot( artifact.getVersion() ); String baseVersion = VersionUtil.getBaseVersion( artifact.getVersion() ); artifacts = metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(), VersionUtil.getBaseVersion( artifact.getVersion() ) );
@Override public boolean accept( File dir, String name ) { if ( name.startsWith( artifactId + "-" ) && name.endsWith( ".pom" ) ) { String v = name.substring( artifactId.length() + 1, name.length() - 4 ); v = VersionUtil.getBaseVersion( v ); if ( v.equals( projectVersion ) ) { return true; } } return false; } }
String version; String idSubStrFromVersion = id.substring( index ); if ( idSubStrFromVersion.startsWith( projectVersion ) && !VersionUtil.isUniqueSnapshot( projectVersion ) ) else if ( VersionUtil.isGenericSnapshot( projectVersion ) )
if ( !VersionUtil.isSnapshot( artifactRef.getVersion( ) ) ) for ( String version : repoContent.getVersions( reference ) ) if ( !VersionUtil.isSnapshot( version ) ) if ( releasedVersions.contains( VersionUtil.getReleaseVersion( artifactRef.getVersion( ) ) ) )
VersionUtil.isSnapshot( artifact.getVersion() ) | VersionUtil.isGenericSnapshot( artifact.getVersion() ); String baseVersion = VersionUtil.getBaseVersion( artifact.getVersion() ); artifacts = metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(), VersionUtil.getBaseVersion( artifact.getVersion() ) );
@Override public boolean test( Path dir ) { final String name = dir.getFileName().toString(); if ( name.startsWith( artifactId + "-" ) && name.endsWith( ".pom" ) ) { String v = name.substring( artifactId.length() + 1, name.length() - 4 ); v = VersionUtil.getBaseVersion( v ); if ( v.equals( projectVersion ) ) { return true; } } return false; }
String version; String idSubStrFromVersion = id.substring( index ); if ( idSubStrFromVersion.startsWith( projectVersion ) && !VersionUtil.isUniqueSnapshot( projectVersion ) ) else if ( VersionUtil.isGenericSnapshot( projectVersion ) )
if ( !VersionUtil.isSnapshot( artifactRef.getVersion() ) ) for ( String version : repoContent.getVersions( reference ) ) if ( !VersionUtil.isSnapshot( version ) ) if ( releasedVersions.contains( VersionUtil.getReleaseVersion( artifactRef.getVersion() ) ) )
if ( VersionUtil.isSnapshot( version ) )
public ArchivaArtifact( ArchivaArtifactModel artifactModel ) { this.model = artifactModel; model.setSnapshot( VersionUtil.isSnapshot( model.getVersion() ) ); this.baseVersion = VersionUtil.getBaseVersion( model.getVersion() ); }
public String toMetadataPath( VersionedReference reference ) { StringBuilder path = new StringBuilder(); 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(); }
if ( VersionUtil.isGenericSnapshot( newArtifactReference.getVersion( ) ) ) else if ( VersionUtil.isUniqueSnapshot( newArtifactReference.getVersion( ) ) )
public static boolean isSnapshot( String version ) { Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version ); if ( m.matches() ) { return true; } else { return isGenericSnapshot( version ); } }
private boolean isProjectVersion( File dir ) { final String artifactId = dir.getParentFile().getName(); final String projectVersion = dir.getName(); // check if there is a POM artifact file to ensure it is a version directory File[] files; if ( VersionUtil.isSnapshot( projectVersion ) ) { files = dir.listFiles( new PomFilenameFilter( artifactId, projectVersion ) ); } else { final String pomFile = artifactId + "-" + projectVersion + ".pom"; files = dir.listFiles( new PomFileFilter( pomFile ) ); } if ( files != null && files.length > 0 ) { return true; } // if a metadata file is present, check if this is the "version" directory, marking it as a project version ArchivaRepositoryMetadata metadata = readMetadata( dir ); if ( metadata != null && projectVersion.equals( metadata.getVersion() ) ) { return true; } return false; }
if ( VersionUtil.isSnapshot( artifact.getVersion() ) ) sb.append( '/' ).append( VersionUtil.getBaseVersion( artifact.getVersion() ) );
public String toPath( VersionedReference reference ) { StringBuilder path = new StringBuilder(); 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(); }