Add pom properties to ProjectVersionMetadata

This commit is contained in:
Carlos Sanchez 2014-11-21 20:12:53 +01:00
parent 5d29c9ff1d
commit b1838d2e3c
3 changed files with 26 additions and 0 deletions

View File

@ -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<Dependency> dependencies = new ArrayList<>();
private Map<String, String> properties = new HashMap<String, String>();
private boolean incomplete;
public String getId()
@ -184,6 +190,22 @@ public class ProjectVersionMetadata
this.dependencies.add( dependency );
}
public Map<String, String> getProperties()
{
return properties;
}
public void setProperties( Map<String, String> properties )
{
this.properties = properties;
}
@SuppressWarnings( { "unchecked", "rawtypes" } )
public void setProperties( Properties properties )
{
setProperties( new HashMap<String, String>((Map) properties ) );
}
public boolean isIncomplete()
{
return incomplete;

View File

@ -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() );

View File

@ -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