mirror of https://github.com/apache/maven.git
applied our coding conventions (no code change)
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@725035 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
845dfab57c
commit
d242ddfaf2
|
@ -20,6 +20,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>maven-mercury</artifactId>
|
<artifactId>maven-mercury</artifactId>
|
||||||
<name>Maven Mercury</name>
|
<name>Maven Mercury</name>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.mercury</groupId>
|
<groupId>org.apache.maven.mercury</groupId>
|
||||||
|
@ -44,6 +45,7 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -51,5 +53,6 @@
|
||||||
<artifactId>plexus-component-metadata</artifactId>
|
<artifactId>plexus-component-metadata</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.maven.shared.model.ModelTransformerContext;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Maven supplied plexus component that implements POM dependency processing for Mercury
|
* Maven supplied plexus component that implements POM dependency processing for Mercury
|
||||||
*
|
*
|
||||||
* @author Shane Isbell
|
* @author Shane Isbell
|
||||||
|
@ -34,9 +34,10 @@ import org.codehaus.plexus.component.annotations.Component;
|
||||||
*/
|
*/
|
||||||
@Component( role=DependencyProcessor.class, hint="maven" )
|
@Component( role=DependencyProcessor.class, hint="maven" )
|
||||||
public final class MavenDependencyProcessor
|
public final class MavenDependencyProcessor
|
||||||
implements DependencyProcessor
|
implements DependencyProcessor
|
||||||
{
|
{
|
||||||
public List<ArtifactBasicMetadata> getDependencies( ArtifactBasicMetadata bmd, MetadataReader mdReader, Map system, Map user )
|
public List<ArtifactBasicMetadata> getDependencies( ArtifactBasicMetadata bmd, MetadataReader mdReader, Map system,
|
||||||
|
Map user )
|
||||||
throws MetadataReaderException, DependencyProcessorException
|
throws MetadataReaderException, DependencyProcessorException
|
||||||
{
|
{
|
||||||
if ( bmd == null )
|
if ( bmd == null )
|
||||||
|
@ -50,23 +51,26 @@ implements DependencyProcessor
|
||||||
}
|
}
|
||||||
|
|
||||||
List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>();
|
List<InterpolatorProperty> interpolatorProperties = new ArrayList<InterpolatorProperty>();
|
||||||
interpolatorProperties.add( new InterpolatorProperty( "${mavenVersion}", "3.0-SNAPSHOT", PomInterpolatorTag.SYSTEM_PROPERTIES.name() ) );
|
interpolatorProperties.add( new InterpolatorProperty( "${mavenVersion}", "3.0-SNAPSHOT",
|
||||||
|
PomInterpolatorTag.SYSTEM_PROPERTIES.name() ) );
|
||||||
|
|
||||||
if ( system != null )
|
if ( system != null )
|
||||||
{
|
{
|
||||||
interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties( system, PomInterpolatorTag.SYSTEM_PROPERTIES.name() ) );
|
interpolatorProperties.addAll(
|
||||||
|
InterpolatorProperty.toInterpolatorProperties( system, PomInterpolatorTag.SYSTEM_PROPERTIES.name() ) );
|
||||||
}
|
}
|
||||||
if ( user != null )
|
if ( user != null )
|
||||||
{
|
{
|
||||||
interpolatorProperties.addAll( InterpolatorProperty.toInterpolatorProperties( user, PomInterpolatorTag.USER_PROPERTIES.name() ) );
|
interpolatorProperties.addAll(
|
||||||
|
InterpolatorProperty.toInterpolatorProperties( user, PomInterpolatorTag.USER_PROPERTIES.name() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// MavenDomainModel superPom =
|
// MavenDomainModel superPom =
|
||||||
// new MavenDomainModel(MavenDependencyProcessor.class.getResourceAsStream( "pom-4.0.0.xml" ));
|
// new MavenDomainModel(MavenDependencyProcessor.class.getResourceAsStream( "pom-4.0.0.xml" ));
|
||||||
// domainModels.add(superPom);
|
// domainModels.add(superPom);
|
||||||
|
|
||||||
byte[] superBytes = mdReader.readMetadata( bmd );
|
byte[] superBytes = mdReader.readMetadata( bmd );
|
||||||
|
|
||||||
|
@ -91,11 +95,15 @@ implements DependencyProcessor
|
||||||
}
|
}
|
||||||
|
|
||||||
PomTransformer transformer = new PomTransformer( new MavenDomainModelFactory() );
|
PomTransformer transformer = new PomTransformer( new MavenDomainModelFactory() );
|
||||||
ModelTransformerContext ctx = new ModelTransformerContext( Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
|
ModelTransformerContext ctx =
|
||||||
|
new ModelTransformerContext( Arrays.asList( new ArtifactModelContainerFactory(),
|
||||||
|
new IdModelContainerFactory() ) );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MavenDomainModel model = ( (MavenDomainModel) ctx.transform( domainModels, transformer, transformer, null, interpolatorProperties, null ) );
|
MavenDomainModel model =
|
||||||
|
( (MavenDomainModel) ctx.transform( domainModels, transformer, transformer, null,
|
||||||
|
interpolatorProperties, null ) );
|
||||||
return model.getDependencyMetadata();
|
return model.getDependencyMetadata();
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
|
@ -110,7 +118,8 @@ implements DependencyProcessor
|
||||||
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
||||||
if ( domainModel.hasParent() )
|
if ( domainModel.hasParent() )
|
||||||
{
|
{
|
||||||
MavenDomainModel parentDomainModel = new MavenDomainModel( mdReader.readMetadata( domainModel.getParentMetadata() ) );
|
MavenDomainModel parentDomainModel =
|
||||||
|
new MavenDomainModel( mdReader.readMetadata( domainModel.getParentMetadata() ) );
|
||||||
domainModels.add( parentDomainModel );
|
domainModels.add( parentDomainModel );
|
||||||
domainModels.addAll( getParentsOfDomainModel( parentDomainModel, mdReader ) );
|
domainModels.addAll( getParentsOfDomainModel( parentDomainModel, mdReader ) );
|
||||||
}
|
}
|
||||||
|
@ -122,10 +131,12 @@ implements DependencyProcessor
|
||||||
List<ModelProperty> properties = new ArrayList<ModelProperty>();
|
List<ModelProperty> properties = new ArrayList<ModelProperty>();
|
||||||
for ( ModelProperty mp : modelProperties )
|
for ( ModelProperty mp : modelProperties )
|
||||||
{
|
{
|
||||||
if ( mp.getUri().startsWith( ProjectUri.Profiles.Profile.xUri ) && !mp.getUri().equals( ProjectUri.Profiles.Profile.id )
|
if ( mp.getUri().startsWith( ProjectUri.Profiles.Profile.xUri )
|
||||||
|
&& !mp.getUri().equals( ProjectUri.Profiles.Profile.id )
|
||||||
&& !mp.getUri().startsWith( ProjectUri.Profiles.Profile.Activation.xUri ) )
|
&& !mp.getUri().startsWith( ProjectUri.Profiles.Profile.Activation.xUri ) )
|
||||||
{
|
{
|
||||||
properties.add( new ModelProperty( mp.getUri().replace( ProjectUri.Profiles.Profile.xUri, ProjectUri.xUri ), mp.getResolvedValue() ) );
|
properties.add( new ModelProperty( mp.getUri().replace( ProjectUri.Profiles.Profile.xUri,
|
||||||
|
ProjectUri.xUri ), mp.getResolvedValue() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return properties;
|
return properties;
|
||||||
|
|
|
@ -46,7 +46,9 @@ import org.apache.maven.shared.model.impl.DefaultModelDataSource;
|
||||||
/**
|
/**
|
||||||
* Provides a wrapper for the maven model.
|
* Provides a wrapper for the maven model.
|
||||||
*/
|
*/
|
||||||
public final class MavenDomainModel implements DomainModel {
|
public final class MavenDomainModel
|
||||||
|
implements DomainModel
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bytes containing the underlying model
|
* Bytes containing the underlying model
|
||||||
|
@ -60,171 +62,220 @@ public final class MavenDomainModel implements DomainModel {
|
||||||
|
|
||||||
private ArtifactBasicMetadata parentMetadata;
|
private ArtifactBasicMetadata parentMetadata;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @throws IOException if there is a problem constructing the model
|
* @throws IOException if there is a problem constructing the model
|
||||||
*/
|
*/
|
||||||
public MavenDomainModel( byte[] bytes )
|
public MavenDomainModel( byte[] bytes )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
this( new ByteArrayInputStream(bytes) );
|
this( new ByteArrayInputStream( bytes ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @throws IOException if there is a problem constructing the model
|
* @throws IOException if there is a problem constructing the model
|
||||||
*/
|
*/
|
||||||
public MavenDomainModel(InputStream inputStream)
|
public MavenDomainModel( InputStream inputStream )
|
||||||
throws IOException {
|
throws IOException
|
||||||
this(ModelMarshaller.marshallXmlToModelProperties(inputStream, ProjectUri.baseUri, PomTransformer.URIS));
|
{
|
||||||
|
this( ModelMarshaller.marshallXmlToModelProperties( inputStream, ProjectUri.baseUri, PomTransformer.URIS ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @throws IOException if there is a problem constructing the model
|
* @throws IOException if there is a problem constructing the model
|
||||||
*/
|
*/
|
||||||
public MavenDomainModel(List<ModelProperty> modelProperties)
|
public MavenDomainModel( List<ModelProperty> modelProperties )
|
||||||
throws IOException {
|
throws IOException
|
||||||
if (modelProperties == null) {
|
{
|
||||||
throw new IllegalArgumentException("modelProperties: null");
|
if ( modelProperties == null )
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException( "modelProperties: null" );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.modelProperties = new ArrayList<ModelProperty>(modelProperties);
|
this.modelProperties = new ArrayList<ModelProperty>( modelProperties );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasParent() {
|
public boolean hasParent()
|
||||||
//TODO: Expensive call if no parent
|
{
|
||||||
|
// TODO: Expensive call if no parent
|
||||||
return getParentMetadata() != null;
|
return getParentMetadata() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ArtifactBasicMetadata> getDependencyMetadata() throws DataSourceException {
|
public List<ArtifactBasicMetadata> getDependencyMetadata()
|
||||||
|
throws DataSourceException
|
||||||
|
{
|
||||||
List<ArtifactBasicMetadata> metadatas = new ArrayList<ArtifactBasicMetadata>();
|
List<ArtifactBasicMetadata> metadatas = new ArrayList<ArtifactBasicMetadata>();
|
||||||
|
|
||||||
ModelDataSource source = new DefaultModelDataSource();
|
ModelDataSource source = new DefaultModelDataSource();
|
||||||
source.init(modelProperties, Arrays.asList(new ArtifactModelContainerFactory(), new IdModelContainerFactory()));
|
source.init( modelProperties,
|
||||||
for(ModelContainer modelContainer: source.queryFor(ProjectUri.Dependencies.Dependency.xUri)) {
|
Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
|
||||||
metadatas.add(transformContainerToMetadata(modelContainer));
|
|
||||||
|
for ( ModelContainer modelContainer : source.queryFor( ProjectUri.Dependencies.Dependency.xUri ) )
|
||||||
|
{
|
||||||
|
metadatas.add( transformContainerToMetadata( modelContainer ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return metadatas;
|
return metadatas;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ModelContainer> getActiveProfileContainers(List<InterpolatorProperty> properties) throws DataSourceException {
|
public Collection<ModelContainer> getActiveProfileContainers( List<InterpolatorProperty> properties )
|
||||||
|
throws DataSourceException
|
||||||
|
{
|
||||||
ModelDataSource dataSource = new DefaultModelDataSource();
|
ModelDataSource dataSource = new DefaultModelDataSource();
|
||||||
dataSource.init(modelProperties, Arrays.asList( new ArtifactModelContainerFactory(), new IdModelContainerFactory() ) );
|
dataSource.init( modelProperties, Arrays.asList( new ArtifactModelContainerFactory(),
|
||||||
return new ProfileContext(dataSource, properties).getActiveProfiles();
|
new IdModelContainerFactory() ) );
|
||||||
|
return new ProfileContext( dataSource, properties ).getActiveProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtifactBasicMetadata getParentMetadata() {
|
public ArtifactBasicMetadata getParentMetadata()
|
||||||
if (parentMetadata != null) {
|
{
|
||||||
return copyArtifactBasicMetadata(parentMetadata);
|
if ( parentMetadata != null )
|
||||||
|
{
|
||||||
|
return copyArtifactBasicMetadata( parentMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
String groupId = null, artifactId = null, version = null;
|
String groupId = null, artifactId = null, version = null;
|
||||||
|
|
||||||
for (ModelProperty mp : modelProperties) {
|
for ( ModelProperty mp : modelProperties )
|
||||||
if (mp.getUri().equals(ProjectUri.Parent.version)) {
|
{
|
||||||
|
if ( mp.getUri().equals( ProjectUri.Parent.version ) )
|
||||||
|
{
|
||||||
version = mp.getValue();
|
version = mp.getValue();
|
||||||
} else if (mp.getUri().equals(ProjectUri.Parent.artifactId)) {
|
}
|
||||||
|
else if ( mp.getUri().equals( ProjectUri.Parent.artifactId ) )
|
||||||
|
{
|
||||||
artifactId = mp.getValue();
|
artifactId = mp.getValue();
|
||||||
} else if (mp.getUri().equals(ProjectUri.Parent.groupId)) {
|
}
|
||||||
|
else if ( mp.getUri().equals( ProjectUri.Parent.groupId ) )
|
||||||
|
{
|
||||||
groupId = mp.getValue();
|
groupId = mp.getValue();
|
||||||
}
|
}
|
||||||
if (groupId != null && artifactId != null && version != null) {
|
if ( groupId != null && artifactId != null && version != null )
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupId == null || artifactId == null || version == null) {
|
if ( groupId == null || artifactId == null || version == null )
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
parentMetadata = new ArtifactBasicMetadata();
|
parentMetadata = new ArtifactBasicMetadata();
|
||||||
parentMetadata.setArtifactId(artifactId);
|
parentMetadata.setArtifactId( artifactId );
|
||||||
parentMetadata.setVersion(version);
|
parentMetadata.setVersion( version );
|
||||||
parentMetadata.setGroupId(groupId);
|
parentMetadata.setGroupId( groupId );
|
||||||
|
|
||||||
return copyArtifactBasicMetadata(parentMetadata);
|
return copyArtifactBasicMetadata( parentMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArtifactBasicMetadata copyArtifactBasicMetadata(ArtifactBasicMetadata metadata) {
|
private ArtifactBasicMetadata copyArtifactBasicMetadata( ArtifactBasicMetadata metadata )
|
||||||
|
{
|
||||||
ArtifactBasicMetadata amd = new ArtifactBasicMetadata();
|
ArtifactBasicMetadata amd = new ArtifactBasicMetadata();
|
||||||
amd.setArtifactId(metadata.getArtifactId());
|
amd.setArtifactId( metadata.getArtifactId() );
|
||||||
amd.setGroupId(metadata.getGroupId());
|
amd.setGroupId( metadata.getGroupId() );
|
||||||
amd.setVersion(metadata.getVersion());
|
amd.setVersion( metadata.getVersion() );
|
||||||
return amd;
|
return amd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.apache.maven.shared.model.DomainModel#getEventHistory()
|
* @see org.apache.maven.shared.model.DomainModel#getEventHistory()
|
||||||
*/
|
*/
|
||||||
public String getEventHistory() {
|
public String getEventHistory()
|
||||||
|
{
|
||||||
return eventHistory;
|
return eventHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.apache.maven.shared.model.DomainModel#setEventHistory(String)
|
* @see org.apache.maven.shared.model.DomainModel#setEventHistory(String)
|
||||||
*/
|
*/
|
||||||
public void setEventHistory(String eventHistory) {
|
public void setEventHistory( String eventHistory )
|
||||||
if (eventHistory == null) {
|
{
|
||||||
throw new IllegalArgumentException("eventHistory: null");
|
if ( eventHistory == null )
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException( "eventHistory: null" );
|
||||||
}
|
}
|
||||||
this.eventHistory = eventHistory;
|
this.eventHistory = eventHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ModelProperty> getModelProperties() throws IOException {
|
public List<ModelProperty> getModelProperties()
|
||||||
return new ArrayList<ModelProperty>(modelProperties);
|
throws IOException
|
||||||
|
{
|
||||||
|
return new ArrayList<ModelProperty>( modelProperties );
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArtifactBasicMetadata transformContainerToMetadata( ModelContainer container ) throws DataSourceException
|
private ArtifactBasicMetadata transformContainerToMetadata( ModelContainer container )
|
||||||
|
throws DataSourceException
|
||||||
{
|
{
|
||||||
List<ModelProperty> modelProperties = container.getProperties();
|
List<ModelProperty> modelProperties = container.getProperties();
|
||||||
|
|
||||||
ArtifactBasicMetadata metadata = new ArtifactBasicMetadata();
|
ArtifactBasicMetadata metadata = new ArtifactBasicMetadata();
|
||||||
for ( ModelProperty mp : modelProperties )
|
for ( ModelProperty mp : modelProperties )
|
||||||
{
|
{
|
||||||
if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.groupId)) {
|
if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.groupId ) )
|
||||||
metadata.setGroupId(mp.getValue());
|
{
|
||||||
} else if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.artifactId)) {
|
metadata.setGroupId( mp.getValue() );
|
||||||
metadata.setArtifactId(mp.getValue());
|
}
|
||||||
} else if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.version)) {
|
else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.artifactId ) )
|
||||||
metadata.setVersion(mp.getValue());
|
{
|
||||||
} else if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.classifier)) {
|
metadata.setArtifactId( mp.getValue() );
|
||||||
metadata.setClassifier(mp.getValue());
|
}
|
||||||
} else if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.scope)) {
|
else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.version ) )
|
||||||
metadata.setScope(mp.getValue());
|
{
|
||||||
} else if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.type)) {
|
metadata.setVersion( mp.getValue() );
|
||||||
metadata.setType(mp.getValue());
|
}
|
||||||
} else if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.optional)) {
|
else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.classifier ) )
|
||||||
metadata.setOptional(mp.getValue());
|
{
|
||||||
|
metadata.setClassifier( mp.getValue() );
|
||||||
|
}
|
||||||
|
else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.scope ) )
|
||||||
|
{
|
||||||
|
metadata.setScope( mp.getValue() );
|
||||||
|
}
|
||||||
|
else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.type ) )
|
||||||
|
{
|
||||||
|
metadata.setType( mp.getValue() );
|
||||||
|
}
|
||||||
|
else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.optional ) )
|
||||||
|
{
|
||||||
|
metadata.setOptional( mp.getValue() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(metadata.getScope() == null) {
|
if ( metadata.getScope() == null )
|
||||||
metadata.setScope("runtime");
|
{
|
||||||
|
metadata.setScope( "runtime" );
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelDataSource dataSource = new DefaultModelDataSource();
|
ModelDataSource dataSource = new DefaultModelDataSource();
|
||||||
dataSource.init(container.getProperties(), Arrays.asList(new ArtifactModelContainerFactory(), new ExclusionModelContainerFactory()) );
|
dataSource.init( container.getProperties(), Arrays.asList( new ArtifactModelContainerFactory(),
|
||||||
|
new ExclusionModelContainerFactory() ) );
|
||||||
List<ArtifactBasicMetadata> exclusions = new ArrayList<ArtifactBasicMetadata>();
|
List<ArtifactBasicMetadata> exclusions = new ArrayList<ArtifactBasicMetadata>();
|
||||||
|
|
||||||
for(ModelContainer exclusion : dataSource.queryFor(ProjectUri.Dependencies.Dependency.Exclusions.Exclusion.xUri)) {
|
for ( ModelContainer exclusion : dataSource.queryFor( ProjectUri.Dependencies.Dependency.Exclusions.Exclusion.xUri ) )
|
||||||
|
{
|
||||||
ArtifactBasicMetadata meta = new ArtifactBasicMetadata();
|
ArtifactBasicMetadata meta = new ArtifactBasicMetadata();
|
||||||
exclusions.add(meta);
|
exclusions.add( meta );
|
||||||
|
|
||||||
for(ModelProperty mp : exclusion.getProperties()) {
|
for ( ModelProperty mp : exclusion.getProperties() )
|
||||||
if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.Exclusions.Exclusion.artifactId)) {
|
{
|
||||||
meta.setArtifactId(mp.getValue());
|
if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.Exclusions.Exclusion.artifactId ) )
|
||||||
} else if(mp.getUri().equals(ProjectUri.Dependencies.Dependency.Exclusions.Exclusion.groupId)) {
|
{
|
||||||
meta.setGroupId(mp.getValue());
|
meta.setArtifactId( mp.getValue() );
|
||||||
|
}
|
||||||
|
else if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.Exclusions.Exclusion.groupId ) )
|
||||||
|
{
|
||||||
|
meta.setGroupId( mp.getValue() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
metadata.setExclusions(exclusions);
|
metadata.setExclusions( exclusions );
|
||||||
|
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,13 @@ import org.apache.maven.shared.model.ModelProperty;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class MavenDomainModelFactory implements DomainModelFactory {
|
public class MavenDomainModelFactory
|
||||||
|
implements DomainModelFactory
|
||||||
public DomainModel createDomainModel(List<ModelProperty> modelProperties) throws IOException {
|
{
|
||||||
return new MavenDomainModel(modelProperties);
|
|
||||||
|
public DomainModel createDomainModel( List<ModelProperty> modelProperties )
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
return new MavenDomainModel( modelProperties );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue