From b1838d2e3ce5cc3ac5406b6432192ce0200306af Mon Sep 17 00:00:00 2001 From: Carlos Sanchez Date: Fri, 21 Nov 2014 20:12:53 +0100 Subject: [PATCH] Add pom properties to ProjectVersionMetadata --- .../model/ProjectVersionMetadata.java | 22 +++++++++++++++++++ .../maven2/Maven2RepositoryStorage.java | 1 + .../Maven2RepositoryMetadataResolverTest.java | 3 +++ 3 files changed, 26 insertions(+) diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ProjectVersionMetadata.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ProjectVersionMetadata.java index 1ff3401fe..967eb0d13 100644 --- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ProjectVersionMetadata.java +++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ProjectVersionMetadata.java @@ -20,8 +20,12 @@ package org.apache.archiva.metadata.model; */ import javax.xml.bind.annotation.XmlRootElement; + import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Properties; @XmlRootElement( name = "projectVersionMetadata" ) public class ProjectVersionMetadata @@ -52,6 +56,8 @@ public class ProjectVersionMetadata private List dependencies = new ArrayList<>(); + private Map properties = new HashMap(); + private boolean incomplete; public String getId() @@ -184,6 +190,22 @@ public class ProjectVersionMetadata this.dependencies.add( dependency ); } + public Map getProperties() + { + return properties; + } + + public void setProperties( Map properties ) + { + this.properties = properties; + } + + @SuppressWarnings( { "unchecked", "rawtypes" } ) + public void setProperties( Properties properties ) + { + setProperties( new HashMap((Map) properties ) ); + } + public boolean isIncomplete() { return incomplete; diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java index 44d294742..a75d007e4 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java @@ -372,6 +372,7 @@ public class Maven2RepositoryStorage metadata.setOrganization( convertOrganization( model.getOrganization() ) ); metadata.setScm( convertScm( model.getScm() ) ); metadata.setUrl( model.getUrl() ); + metadata.setProperties( model.getProperties() ); MavenProjectFacet facet = new MavenProjectFacet(); facet.setGroupId( model.getGroupId() != null ? model.getGroupId() : model.getParent().getGroupId() ); diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java index f23e2d62a..3f3b8e2dc 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java +++ b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryMetadataResolverTest.java @@ -209,6 +209,9 @@ public class Maven2RepositoryMetadataResolverTest assertDependency( dependencies.get( 7 ), "junit", "junit", "3.8.1", "test" ); assertDependency( dependencies.get( 8 ), "easymock", "easymock", "1.2_Java1.3", "test" ); assertDependency( dependencies.get( 9 ), "easymock", "easymockclassextension", "1.2", "test" ); + + assertEquals( 8, metadata.getProperties().size() ); + assertEquals( "http://www.apache.org/images/asf_logo_wide.gif", metadata.getProperties().get("organization.logo") ); } @Test -- 2.39.5