diff options
author | Brett Porter <brett@apache.org> | 2009-12-16 00:38:50 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2009-12-16 00:38:50 +0000 |
commit | 0f4bec30498077a096182f0c085a2d2b116e3751 (patch) | |
tree | 9beae8f345bef19ad83e4ef574e95494d0c353de /archiva-modules/archiva-base | |
parent | 4331620db667226493479efa67b44ae27e890582 (diff) | |
download | archiva-0f4bec30498077a096182f0c085a2d2b116e3751.tar.gz archiva-0f4bec30498077a096182f0c085a2d2b116e3751.zip |
[MRM-1301] add back problem reporting for invalid / missing POM
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@891084 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base')
2 files changed, 8 insertions, 5 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java index 762d3adf7..3275405d4 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/src/main/java/org/apache/archiva/consumers/metadata/ArchivaMetadataCreationConsumer.java @@ -161,13 +161,14 @@ public class ArchivaMetadataCreationConsumer project.setNamespace( artifact.getGroupId() ); project.setId( artifact.getArtifactId() ); + String projectVersion = VersionUtil.getBaseVersion( artifact.getVersion() ); // TODO: maybe not too efficient since it may have already been read and stored for this artifact ProjectVersionMetadata versionMetadata; try { versionMetadata = storageResolver.getProjectVersion( repository.getId(), artifact.getGroupId(), artifact.getArtifactId(), - VersionUtil.getBaseVersion( artifact.getVersion() ) ); + projectVersion ); } catch ( MetadataResolverException e ) { @@ -176,7 +177,9 @@ public class ArchivaMetadataCreationConsumer if ( versionMetadata == null ) { - throw new ConsumerException( "Unable to read metadata for artifact: " + artifact ); + log.warn( "Missing POM for artifact: " + artifact + "; creating empty metadata" ); + versionMetadata = new ProjectVersionMetadata(); + versionMetadata.setId( projectVersion ); } ArtifactMetadata artifactMeta = new ArtifactMetadata(); @@ -209,8 +212,8 @@ public class ArchivaMetadataCreationConsumer // TODO: transaction // read the metadata and update it if it is newer or doesn't exist - metadataRepository.updateArtifact( repository.getId(), project.getNamespace(), project.getId(), - versionMetadata.getId(), artifactMeta ); + metadataRepository.updateArtifact( repository.getId(), project.getNamespace(), project.getId(), projectVersion, + artifactMeta ); metadataRepository.updateProjectVersion( repository.getId(), project.getNamespace(), project.getId(), versionMetadata ); metadataRepository.updateProject( repository.getId(), project ); diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java index d5f899471..c42488105 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java @@ -116,7 +116,7 @@ public class TestMetadataRepository return null; //To change body of implemented methods use File | Settings | File Templates. } - public void addMetadataFacet( String repositoryId, String facetId, MetadataFacet metadataFacet ) + public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet ) { //To change body of implemented methods use File | Settings | File Templates. } |