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; }
if ( VersionUtil.isSnapshot( 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; }
private void mergeWithOutSnapshots( MetadataRepository metadataRepository, List<ArtifactMetadata> sourceArtifacts, String sourceRepoId, String repoid ) throws RepositoryMergerException { List<ArtifactMetadata> artifactsWithOutSnapshots = new ArrayList<>(); for ( ArtifactMetadata metadata : sourceArtifacts ) { if ( VersionUtil.isSnapshot( metadata.getProjectVersion() ) ) //if ( metadata.getProjectVersion().contains( VersionUtil.SNAPSHOT ) ) { artifactsWithOutSnapshots.add( metadata ); } else { triggerAuditEvent( repoid, metadata.getId(), AuditEvent.MERGING_REPOSITORIES ); } } sourceArtifacts.removeAll( artifactsWithOutSnapshots ); Filter<ArtifactMetadata> artifactListWithOutSnapShots = new IncludesFilter<ArtifactMetadata>( sourceArtifacts ); repositoryMerger.merge( metadataRepository, sourceRepoId, repoid, artifactListWithOutSnapShots ); } }
private void mergeWithOutSnapshots( MetadataRepository metadataRepository, List<ArtifactMetadata> sourceArtifacts, String sourceRepoId, String repoid ) throws RepositoryMergerException { List<ArtifactMetadata> artifactsWithOutSnapshots = new ArrayList<>(); for ( ArtifactMetadata metadata : sourceArtifacts ) { if ( VersionUtil.isSnapshot( metadata.getProjectVersion() ) ) //if ( metadata.getProjectVersion().contains( VersionUtil.SNAPSHOT ) ) { artifactsWithOutSnapshots.add( metadata ); } else { triggerAuditEvent( repoid, metadata.getId(), AuditEvent.MERGING_REPOSITORIES ); } } sourceArtifacts.removeAll( artifactsWithOutSnapshots ); Filter<ArtifactMetadata> artifactListWithOutSnapShots = new IncludesFilter<ArtifactMetadata>( sourceArtifacts ); repositoryMerger.merge( metadataRepository, sourceRepoId, repoid, artifactListWithOutSnapShots ); } }
public ArchivaArtifact( ArchivaArtifactModel artifactModel ) { this.model = artifactModel; model.setSnapshot( VersionUtil.isSnapshot( model.getVersion() ) ); this.baseVersion = VersionUtil.getBaseVersion( model.getVersion() ); }
public ArchivaArtifact( ArchivaArtifactModel artifactModel ) { this.model = artifactModel; model.setSnapshot( VersionUtil.isSnapshot( model.getVersion() ) ); this.baseVersion = VersionUtil.getBaseVersion( model.getVersion() ); }
if ( VersionUtil.isSnapshot( artifact.getVersion() ) )
if ( VersionUtil.isSnapshot( version ) && !managedRepository.isSnapshots() )
projectMetadata.setAvailableVersions( availableVersions ); if ( !VersionUtil.isSnapshot( version ) )
projectMetadata.setAvailableVersions( availableVersions ); if ( !VersionUtil.isSnapshot( version ) )
if ( VersionUtil.isSnapshot( artifact.getVersion( ) ) )
if ( !VersionUtil.isSnapshot( artifact.getVersion() ) )
if ( !VersionUtil.isSnapshot( artifact.getVersion() ) )
if ( VersionUtil.isSnapshot( artifact.getVersion() ) )
projectMetadata.setAvailableVersions( availableVersions ); if ( !VersionUtil.isSnapshot( artifactTransferRequest.getVersion() ) )
projectMetadata.setAvailableVersions( availableVersions ); if ( !VersionUtil.isSnapshot( artifactTransferRequest.getVersion() ) )
model.setClassifier( StringUtils.defaultString( classifier ) ); model.setType( type ); model.setSnapshot( VersionUtil.isSnapshot( version ) ); model.setRepositoryId(repositoryId);
model.setClassifier( StringUtils.defaultString( classifier ) ); model.setType( type ); model.setSnapshot( VersionUtil.isSnapshot( version ) ); model.setRepositoryId(repositoryId);
projectMetadata.setLastUpdatedTimestamp( lastUpdatedTimestamp ); if ( !VersionUtil.isSnapshot( artifactMetadata.getVersion() ) )