[MRM-1282] only create version metadata if necessary

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@893368 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2009-12-23 01:01:32 +00:00
parent b85d4d795b
commit 4ad4cd3ced
1 changed files with 7 additions and 2 deletions

View File

@ -166,11 +166,13 @@ public class ArchivaMetadataCreationConsumer
storageResolver.getProjectVersion( repository.getId(), artifact.getGroupId(), artifact.getArtifactId(),
projectVersion );
boolean createVersionMetadata = false;
if ( versionMetadata == null )
{
log.warn( "Missing POM for artifact: " + path + "; creating empty metadata" );
versionMetadata = new ProjectVersionMetadata();
versionMetadata.setId( projectVersion );
createVersionMetadata = true;
}
ArtifactMetadata artifactMeta = new ArtifactMetadata();
@ -205,8 +207,11 @@ public class ArchivaMetadataCreationConsumer
// read the metadata and update it if it is newer or doesn't exist
metadataRepository.updateArtifact( repository.getId(), project.getNamespace(), project.getId(), projectVersion,
artifactMeta );
if ( createVersionMetadata )
{
metadataRepository.updateProjectVersion( repository.getId(), project.getNamespace(), project.getId(),
versionMetadata );
}
metadataRepository.updateProject( repository.getId(), project );
}