From 82f8a22ed6002ccb064dec41f6dd2f4c136ea52b Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Thu, 24 Dec 2009 04:20:41 +0000 Subject: [PATCH] [MRM-1301] remove any problem reports when metadata is re-processed git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@893692 13f79535-47bb-0310-9956-ffa450edef68 --- .../Maven2RepositoryMetadataResolver.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolver.java index 68878d6ee..53603fc67 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolver.java @@ -95,6 +95,15 @@ public class Maven2RepositoryMetadataResolver private static final Filter ALL = new AllFilter(); + private static final String PROBLEM_MISSING_POM = "missing-pom"; + + private static final String PROBLEM_INVALID_POM = "invalid-pom"; + + private static final String PROBLEM_MISLOCATED_POM = "mislocated-pom"; + + private static final List POTENTIAL_PROBLEMS = + Arrays.asList( PROBLEM_INVALID_POM, PROBLEM_MISSING_POM, PROBLEM_MISLOCATED_POM ); + public ProjectMetadata getProject( String repoId, String namespace, String projectId ) { // TODO: could natively implement the "shared model" concept from the browse action to avoid needing it there? @@ -105,6 +114,11 @@ public class Maven2RepositoryMetadataResolver String projectVersion ) throws MetadataResolutionException { + // TODO: an event mechanism would remove coupling to the problem reporting plugin + // TODO: this removes all problems - do we need something that just removes the problems created by this resolver? + String name = RepositoryProblemFacet.createName( namespace, projectId, projectVersion, null ); + metadataRepository.removeMetadataFacet( repoId, RepositoryProblemFacet.FACET_ID, name ); + ManagedRepositoryConfiguration repositoryConfiguration = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoId ); @@ -142,7 +156,7 @@ public class Maven2RepositoryMetadataResolver if ( !file.exists() ) { // TODO: an event mechanism would remove coupling to the problem reporting plugin - addProblemReport( repoId, namespace, projectId, projectVersion, "missing-pom", + addProblemReport( repoId, namespace, projectId, projectVersion, PROBLEM_MISSING_POM, "The artifact's POM file '" + file + "' was missing" ); // metadata could not be resolved @@ -162,7 +176,7 @@ public class Maven2RepositoryMetadataResolver } catch ( ModelBuildingException e ) { - addProblemReport( repoId, namespace, projectId, projectVersion, "invalid-pom", + addProblemReport( repoId, namespace, projectId, projectVersion, PROBLEM_INVALID_POM, "The artifact's POM file '" + file + "' was invalid: " + e.getMessage() ); throw new MetadataResolutionException( e.getMessage() ); @@ -189,7 +203,7 @@ public class Maven2RepositoryMetadataResolver } String msg = message.toString(); - addProblemReport( repoId, namespace, projectId, projectVersion, "mislocated-pom", msg ); + addProblemReport( repoId, namespace, projectId, projectVersion, PROBLEM_MISLOCATED_POM, msg ); throw new MetadataResolutionException( msg ); } -- 2.39.5