diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java index e51a360f0..e69ce4631 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java @@ -728,9 +728,23 @@ public class DefaultRepositoriesService updateMetadata( metadata, metadataFile, lastUpdatedTimestamp, artifact ); } - Collection artifacts = - metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(), - artifact.getVersion() ); + Collection artifacts = Collections.emptyList(); + + if ( snapshotVersion ) + { + String baseVersion = VersionUtil.getBaseVersion( artifact.getVersion() ); + artifacts = + metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(), + baseVersion ); + } + else + { + artifacts = + metadataRepository.getArtifacts( repositoryId, artifact.getGroupId(), artifact.getArtifactId(), + artifact.getVersion() ); + } + + log.debug( "artifacts: {}", artifacts ); for ( ArtifactMetadata artifactMetadata : artifacts ) { @@ -813,6 +827,7 @@ public class DefaultRepositoriesService } finally { + repositorySession.save(); repositorySession.close();