mirror of https://github.com/apache/maven.git
Updated to use latest model-builder. Now detect most specialized model through method, not order of domain model list.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@749870 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9ef5c6edbe
commit
1492907f1b
|
@ -96,6 +96,7 @@ public final class MavenDependencyProcessor
|
||||||
}
|
}
|
||||||
|
|
||||||
MavenDomainModel domainModel = new MavenDomainModel( superBytes );
|
MavenDomainModel domainModel = new MavenDomainModel( superBytes );
|
||||||
|
domainModel.setMostSpecialized(true);
|
||||||
domainModels.add( domainModel );
|
domainModels.add( domainModel );
|
||||||
|
|
||||||
Collection<ModelContainer> activeProfiles = domainModel.getActiveProfileContainers( interpolatorProperties );
|
Collection<ModelContainer> activeProfiles = domainModel.getActiveProfileContainers( interpolatorProperties );
|
||||||
|
|
|
@ -62,6 +62,8 @@ public class PomClassicDomainModel implements InputStreamDomainModel
|
||||||
private List<ModelProperty> modelProperties;
|
private List<ModelProperty> modelProperties;
|
||||||
|
|
||||||
private int lineageCount;
|
private int lineageCount;
|
||||||
|
|
||||||
|
private boolean isMostSpecialized = false;
|
||||||
|
|
||||||
private String parentGroupId = null, parentArtifactId = null, parentVersion = null, parentId = null, parentRelativePath;
|
private String parentGroupId = null, parentArtifactId = null, parentVersion = null, parentId = null, parentRelativePath;
|
||||||
|
|
||||||
|
@ -79,6 +81,13 @@ public class PomClassicDomainModel implements InputStreamDomainModel
|
||||||
}
|
}
|
||||||
initializeProperties( modelProperties );
|
initializeProperties( modelProperties );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PomClassicDomainModel( List<ModelProperty> modelProperties, boolean isMostSpecialized )
|
||||||
|
{
|
||||||
|
this( modelProperties );
|
||||||
|
this.isMostSpecialized = isMostSpecialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -97,6 +106,13 @@ public class PomClassicDomainModel implements InputStreamDomainModel
|
||||||
modelProperties = getModelProperties();
|
modelProperties = getModelProperties();
|
||||||
initializeProperties( modelProperties );
|
initializeProperties( modelProperties );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PomClassicDomainModel( InputStream inputStream, boolean isMostSpecialized )
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
this( inputStream );
|
||||||
|
this.isMostSpecialized = isMostSpecialized;
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeProperties(List<ModelProperty> modelProperties)
|
private void initializeProperties(List<ModelProperty> modelProperties)
|
||||||
{
|
{
|
||||||
|
@ -299,7 +315,7 @@ public class PomClassicDomainModel implements InputStreamDomainModel
|
||||||
s.add(ProjectUri.Profiles.Profile.Reporting.Plugins.Plugin.ReportSets.xUri);
|
s.add(ProjectUri.Profiles.Profile.Reporting.Plugins.Plugin.ReportSets.xUri);
|
||||||
s.add(ProjectUri.Profiles.Profile.Reporting.Plugins.Plugin.ReportSets.ReportSet.configuration);
|
s.add(ProjectUri.Profiles.Profile.Reporting.Plugins.Plugin.ReportSets.ReportSet.configuration);
|
||||||
s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Executions.Execution.configuration);
|
s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Executions.Execution.configuration);
|
||||||
|
s.add(ProjectUri.Profiles.Profile.properties);
|
||||||
s.add(ProjectUri.Profiles.Profile.modules);
|
s.add(ProjectUri.Profiles.Profile.modules);
|
||||||
s.add(ProjectUri.Profiles.Profile.Dependencies.xUri);
|
s.add(ProjectUri.Profiles.Profile.Dependencies.xUri);
|
||||||
s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.configuration);
|
s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.configuration);
|
||||||
|
@ -366,4 +382,14 @@ public class PomClassicDomainModel implements InputStreamDomainModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMostSpecialized()
|
||||||
|
{
|
||||||
|
return isMostSpecialized;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMostSpecialized(boolean isMostSpecialized)
|
||||||
|
{
|
||||||
|
this.isMostSpecialized = isMostSpecialized;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ public class PomTransformer
|
||||||
ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri,
|
ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri,
|
||||||
ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.Exclusions.xUri,
|
ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.Exclusions.xUri,
|
||||||
ProjectUri.Build.Plugins.xUri,
|
ProjectUri.Build.Plugins.xUri,
|
||||||
|
ProjectUri.properties,
|
||||||
ProjectUri.Build.Plugins.Plugin.configuration,
|
ProjectUri.Build.Plugins.Plugin.configuration,
|
||||||
ProjectUri.Reporting.Plugins.xUri,
|
ProjectUri.Reporting.Plugins.xUri,
|
||||||
ProjectUri.Reporting.Plugins.Plugin.configuration,
|
ProjectUri.Reporting.Plugins.Plugin.configuration,
|
||||||
|
@ -472,24 +473,21 @@ public class PomTransformer
|
||||||
boolean containsDistSnapRepo = false;
|
boolean containsDistSnapRepo = false;
|
||||||
boolean containsDistSite = false;
|
boolean containsDistSite = false;
|
||||||
|
|
||||||
int domainModelIndex = -1;
|
|
||||||
|
|
||||||
for ( DomainModel domainModel : domainModels )
|
for ( DomainModel domainModel : domainModels )
|
||||||
{
|
{
|
||||||
domainModelIndex++;
|
|
||||||
|
|
||||||
List<ModelProperty> tmp = domainModel.getModelProperties();
|
List<ModelProperty> tmp = domainModel.getModelProperties();
|
||||||
|
|
||||||
List clearedProperties = new ArrayList<ModelProperty>();
|
List<ModelProperty> clearedProperties = new ArrayList<ModelProperty>();
|
||||||
|
|
||||||
for(TransformerRule rule : transformerRules)
|
for(TransformerRule rule : transformerRules)
|
||||||
{
|
{
|
||||||
rule.execute(tmp, domainModelIndex);
|
rule.execute(tmp, domainModel.isMostSpecialized());
|
||||||
}
|
}
|
||||||
|
|
||||||
for(TransformerRemovalRule rule : transformerRemovalRules)
|
for(TransformerRemovalRule rule : transformerRemovalRules)
|
||||||
{
|
{
|
||||||
tmp.removeAll(rule.executeWithReturnPropertiesToRemove(tmp, domainModelIndex));
|
tmp.removeAll(rule.executeWithReturnPropertiesToRemove(tmp, domainModel.isMostSpecialized()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Project URL TransformerRule
|
// Project URL TransformerRule
|
||||||
|
@ -506,7 +504,7 @@ public class PomTransformer
|
||||||
// Profiles TransformerRule: not inherited
|
// Profiles TransformerRule: not inherited
|
||||||
// Prerequisites TransformerRule: not inherited
|
// Prerequisites TransformerRule: not inherited
|
||||||
// DistributionManagent.Relocation TransformerRule: not inherited
|
// DistributionManagent.Relocation TransformerRule: not inherited
|
||||||
if ( domainModelIndex > 0 )
|
if ( !domainModel.isMostSpecialized() )
|
||||||
{
|
{
|
||||||
for ( ModelProperty mp : tmp )
|
for ( ModelProperty mp : tmp )
|
||||||
{
|
{
|
||||||
|
@ -581,7 +579,7 @@ public class PomTransformer
|
||||||
//Rules processed on collapsed pom
|
//Rules processed on collapsed pom
|
||||||
|
|
||||||
//TransformerRule: Remove duplicate filters
|
//TransformerRule: Remove duplicate filters
|
||||||
modelProperties.removeAll(new DuplicateFiltersTransformerRule().executeWithReturnPropertiesToRemove( modelProperties , 0));
|
modelProperties.removeAll(new DuplicateFiltersTransformerRule().executeWithReturnPropertiesToRemove( modelProperties , false));
|
||||||
|
|
||||||
//TransformerRule: Build plugin config overrides reporting plugin config
|
//TransformerRule: Build plugin config overrides reporting plugin config
|
||||||
return new OverideConfigTransformerRule().execute( modelProperties );
|
return new OverideConfigTransformerRule().execute( modelProperties );
|
||||||
|
|
|
@ -1375,7 +1375,7 @@ public class ProjectUri
|
||||||
"http://apache.org/maven/project/profiles#collection/profile/distributionManagement/status";
|
"http://apache.org/maven/project/profiles#collection/profile/distributionManagement/status";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String properties = "http://apache.org/maven/project/profiles#collection/profile/properties#collection";
|
public static String properties = "http://apache.org/maven/project/profiles#collection/profile/properties";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,6 @@ import java.util.List;
|
||||||
|
|
||||||
public interface TransformerRemovalRule {
|
public interface TransformerRemovalRule {
|
||||||
|
|
||||||
List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, int domainIndex)
|
List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, boolean isMostSpecialized)
|
||||||
throws DataSourceException;
|
throws DataSourceException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,6 @@ import java.util.List;
|
||||||
|
|
||||||
public interface TransformerRule
|
public interface TransformerRule
|
||||||
{
|
{
|
||||||
void execute(List<ModelProperty> modelProperties, int domainIndex) throws DataSourceException;
|
void execute(List<ModelProperty> modelProperties, boolean isMostSpecialized) throws DataSourceException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ import java.util.Arrays;
|
||||||
*/
|
*/
|
||||||
public class DefaultDependencyScopeTransformerRule implements TransformerRule
|
public class DefaultDependencyScopeTransformerRule implements TransformerRule
|
||||||
{
|
{
|
||||||
public void execute(List<ModelProperty> modelProperties, int domainIndex)
|
public void execute(List<ModelProperty> modelProperties, boolean isMostSpecialized)
|
||||||
throws DataSourceException
|
throws DataSourceException
|
||||||
{
|
{
|
||||||
if(domainIndex == 0)
|
if(isMostSpecialized)
|
||||||
{
|
{
|
||||||
ModelDataSource s = new DefaultModelDataSource( modelProperties, Arrays.asList( new ArtifactModelContainerFactory()) );
|
ModelDataSource s = new DefaultModelDataSource( modelProperties, Arrays.asList( new ArtifactModelContainerFactory()) );
|
||||||
for(ModelContainer mc : s.queryFor(ProjectUri.Dependencies.Dependency.xUri))
|
for(ModelContainer mc : s.queryFor(ProjectUri.Dependencies.Dependency.xUri))
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.ArrayList;
|
||||||
*/
|
*/
|
||||||
public class DefaultExecutionIdTransformerRule implements TransformerRemovalRule
|
public class DefaultExecutionIdTransformerRule implements TransformerRemovalRule
|
||||||
{
|
{
|
||||||
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, int domainIndex)
|
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, boolean isMostSpecialized)
|
||||||
throws DataSourceException
|
throws DataSourceException
|
||||||
{
|
{
|
||||||
List<ModelProperty> replace = new ArrayList<ModelProperty>();
|
List<ModelProperty> replace = new ArrayList<ModelProperty>();
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class DuplicateFiltersTransformerRule implements TransformerRemovalRule
|
public class DuplicateFiltersTransformerRule implements TransformerRemovalRule
|
||||||
{
|
{
|
||||||
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, int domainIndex)
|
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, boolean isMostSpecialized)
|
||||||
throws DataSourceException
|
throws DataSourceException
|
||||||
{
|
{
|
||||||
List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
|
List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class MissingGroupIdTransformerRule implements TransformerRule
|
public class MissingGroupIdTransformerRule implements TransformerRule
|
||||||
{
|
{
|
||||||
public void execute(List<ModelProperty> modelProperties, int domainIndex) throws DataSourceException
|
public void execute(List<ModelProperty> modelProperties, boolean isMostSpecialized) throws DataSourceException
|
||||||
{
|
{
|
||||||
if ( getPropertyFor( ProjectUri.groupId, modelProperties ) == null )
|
if ( getPropertyFor( ProjectUri.groupId, modelProperties ) == null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class MissingVersionTransformerRule implements TransformerRule
|
public class MissingVersionTransformerRule implements TransformerRule
|
||||||
{
|
{
|
||||||
public void execute(List<ModelProperty> modelProperties, int domainIndex) throws DataSourceException
|
public void execute(List<ModelProperty> modelProperties, boolean isMostSpecialized) throws DataSourceException
|
||||||
{
|
{
|
||||||
if ( PomTransformer.getPropertyFor( ProjectUri.version, modelProperties ) == null )
|
if ( PomTransformer.getPropertyFor( ProjectUri.version, modelProperties ) == null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,10 +14,10 @@ import java.util.ArrayList;
|
||||||
*/
|
*/
|
||||||
public class ModulesNotInheritedTransformerRule implements TransformerRemovalRule
|
public class ModulesNotInheritedTransformerRule implements TransformerRemovalRule
|
||||||
{
|
{
|
||||||
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, int domainIndex)
|
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, boolean isMostSpecialized)
|
||||||
throws DataSourceException
|
throws DataSourceException
|
||||||
{
|
{
|
||||||
if (domainIndex > 0)
|
if (!isMostSpecialized)
|
||||||
{
|
{
|
||||||
ModelProperty modulesProperty = PomTransformer.getPropertyFor(ProjectUri.Modules.xUri, modelProperties);
|
ModelProperty modulesProperty = PomTransformer.getPropertyFor(ProjectUri.Modules.xUri, modelProperties);
|
||||||
if (modulesProperty != null)
|
if (modulesProperty != null)
|
||||||
|
|
|
@ -13,11 +13,11 @@ import java.util.ArrayList;
|
||||||
*/
|
*/
|
||||||
public class NameNotInheritedTransformerRule implements TransformerRemovalRule
|
public class NameNotInheritedTransformerRule implements TransformerRemovalRule
|
||||||
{
|
{
|
||||||
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, int domainIndex)
|
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, boolean isMostSpecialized)
|
||||||
throws DataSourceException
|
throws DataSourceException
|
||||||
{
|
{
|
||||||
List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
|
List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
|
||||||
if ( domainIndex > 0 )
|
if ( !isMostSpecialized )
|
||||||
{
|
{
|
||||||
for ( ModelProperty mp : modelProperties )
|
for ( ModelProperty mp : modelProperties )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,12 +19,12 @@ import java.util.Arrays;
|
||||||
*/
|
*/
|
||||||
public class NotInheritedPluginExecutionTransformerRule implements TransformerRemovalRule
|
public class NotInheritedPluginExecutionTransformerRule implements TransformerRemovalRule
|
||||||
{
|
{
|
||||||
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, int domainIndex)
|
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, boolean isMostSpecialized)
|
||||||
throws DataSourceException
|
throws DataSourceException
|
||||||
{
|
{
|
||||||
List<ModelProperty> removeProperties = new ArrayList<ModelProperty>();
|
List<ModelProperty> removeProperties = new ArrayList<ModelProperty>();
|
||||||
|
|
||||||
if ( domainIndex > 0 )
|
if ( !isMostSpecialized)
|
||||||
{
|
{
|
||||||
ModelDataSource source = new DefaultModelDataSource( modelProperties, Arrays.asList(
|
ModelDataSource source = new DefaultModelDataSource( modelProperties, Arrays.asList(
|
||||||
new ArtifactModelContainerFactory(), new PluginExecutionIdModelContainerFactory() ));
|
new ArtifactModelContainerFactory(), new PluginExecutionIdModelContainerFactory() ));
|
||||||
|
|
|
@ -17,11 +17,11 @@ import java.util.ArrayList;
|
||||||
*/
|
*/
|
||||||
public class NotInheritedPluginTransformerRule implements TransformerRemovalRule
|
public class NotInheritedPluginTransformerRule implements TransformerRemovalRule
|
||||||
{
|
{
|
||||||
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, int domainIndex)
|
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, boolean isMostSpecialized)
|
||||||
throws DataSourceException
|
throws DataSourceException
|
||||||
{
|
{
|
||||||
List<ModelProperty> removeProperties = new ArrayList<ModelProperty>();
|
List<ModelProperty> removeProperties = new ArrayList<ModelProperty>();
|
||||||
if ( domainIndex > 0 )
|
if ( !isMostSpecialized)
|
||||||
{
|
{
|
||||||
ModelDataSource source = new DefaultModelDataSource( modelProperties, PomTransformer.MODEL_CONTAINER_FACTORIES );
|
ModelDataSource source = new DefaultModelDataSource( modelProperties, PomTransformer.MODEL_CONTAINER_FACTORIES );
|
||||||
List<ModelContainer> containers = source.queryFor( ProjectUri.Build.Plugins.Plugin.xUri );
|
List<ModelContainer> containers = source.queryFor( ProjectUri.Build.Plugins.Plugin.xUri );
|
||||||
|
|
|
@ -10,11 +10,11 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
public class PackagingNotInheritedTransformerRule implements TransformerRemovalRule
|
public class PackagingNotInheritedTransformerRule implements TransformerRemovalRule
|
||||||
{
|
{
|
||||||
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, int domainIndex)
|
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, boolean isMostSpecialized)
|
||||||
throws DataSourceException
|
throws DataSourceException
|
||||||
{
|
{
|
||||||
List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
|
List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
|
||||||
if ( domainIndex > 0 )
|
if ( !isMostSpecialized )
|
||||||
{
|
{
|
||||||
for ( ModelProperty mp : modelProperties )
|
for ( ModelProperty mp : modelProperties )
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,11 +13,11 @@ import java.util.ArrayList;
|
||||||
*/
|
*/
|
||||||
public class RelativePathNotInheritedTransformerRule implements TransformerRemovalRule
|
public class RelativePathNotInheritedTransformerRule implements TransformerRemovalRule
|
||||||
{
|
{
|
||||||
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, int domainIndex)
|
public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty> modelProperties, boolean isMostSpecialized)
|
||||||
throws DataSourceException
|
throws DataSourceException
|
||||||
{
|
{
|
||||||
List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
|
List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
|
||||||
if ( domainIndex > 0 )
|
if ( !isMostSpecialized )
|
||||||
{
|
{
|
||||||
for ( ModelProperty mp : modelProperties )
|
for ( ModelProperty mp : modelProperties )
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,8 +13,8 @@ public class DefaultDomainModel extends PomClassicDomainModel {
|
||||||
|
|
||||||
private List<ModelProperty> modelProperties;
|
private List<ModelProperty> modelProperties;
|
||||||
|
|
||||||
public DefaultDomainModel(List<ModelProperty> modelProperties) {
|
public DefaultDomainModel(List<ModelProperty> modelProperties, boolean isMostSpecialized) {
|
||||||
super( modelProperties);
|
super( modelProperties, isMostSpecialized);
|
||||||
this.modelProperties = modelProperties;
|
this.modelProperties = modelProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,6 @@ import java.io.IOException;
|
||||||
|
|
||||||
public class DefaultDomainModelFactory implements DomainModelFactory {
|
public class DefaultDomainModelFactory implements DomainModelFactory {
|
||||||
public DomainModel createDomainModel(List<ModelProperty> modelProperties) throws IOException {
|
public DomainModel createDomainModel(List<ModelProperty> modelProperties) throws IOException {
|
||||||
return new DefaultDomainModel(modelProperties);
|
return new DefaultDomainModel(modelProperties, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,8 @@ public class EnforcerPomTest
|
||||||
mp2.add(new ModelProperty(ProjectUri.Dependencies.Dependency.artifactId, "aid"));
|
mp2.add(new ModelProperty(ProjectUri.Dependencies.Dependency.artifactId, "aid"));
|
||||||
mp2.add(new ModelProperty(ProjectUri.Dependencies.Dependency.classifier, "tests"));
|
mp2.add(new ModelProperty(ProjectUri.Dependencies.Dependency.classifier, "tests"));
|
||||||
|
|
||||||
DomainModel childModel = new DefaultDomainModel(mp2);
|
DomainModel childModel = new DefaultDomainModel(mp2, true);
|
||||||
DomainModel parentModel = new DefaultDomainModel(mp);
|
DomainModel parentModel = new DefaultDomainModel(mp, false);
|
||||||
|
|
||||||
ModelTransformerContext ctx = new ModelTransformerContext(PomTransformer.MODEL_CONTAINER_INFOS );
|
ModelTransformerContext ctx = new ModelTransformerContext(PomTransformer.MODEL_CONTAINER_INFOS );
|
||||||
|
|
||||||
|
|
|
@ -49,12 +49,12 @@ public class PluginSpecTest {
|
||||||
mp.add(new ModelProperty(ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.Execution.Goals.goal, "xpp3-reader"));
|
mp.add(new ModelProperty(ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.Execution.Goals.goal, "xpp3-reader"));
|
||||||
mp.add(new ModelProperty(ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.Execution.Goals.goal, "xpp3-writer"));
|
mp.add(new ModelProperty(ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.Execution.Goals.goal, "xpp3-writer"));
|
||||||
|
|
||||||
DomainModel parentModel = new DefaultDomainModel(mp);
|
DomainModel parentModel = new DefaultDomainModel(mp, false);
|
||||||
|
|
||||||
ModelTransformerContext ctx = new ModelTransformerContext(PomTransformer.MODEL_CONTAINER_INFOS );
|
ModelTransformerContext ctx = new ModelTransformerContext(PomTransformer.MODEL_CONTAINER_INFOS );
|
||||||
|
|
||||||
ModelTransformer transformer = new PomTransformer(new DefaultDomainModelFactory());
|
ModelTransformer transformer = new PomTransformer(new DefaultDomainModelFactory());
|
||||||
DomainModel domainModel = ctx.transform( Arrays.asList(parentModel, new DefaultDomainModel(mp0)), transformer, transformer );
|
DomainModel domainModel = ctx.transform( Arrays.asList(parentModel, new DefaultDomainModel(mp0, true)), transformer, transformer );
|
||||||
|
|
||||||
|
|
||||||
List<ModelContainerFactory> factories = new ArrayList<ModelContainerFactory>(PomTransformer.MODEL_CONTAINER_FACTORIES);
|
List<ModelContainerFactory> factories = new ArrayList<ModelContainerFactory>(PomTransformer.MODEL_CONTAINER_FACTORIES);
|
||||||
|
|
|
@ -478,7 +478,7 @@ public class DefaultMavenProjectBuilder
|
||||||
|
|
||||||
PomClassicDomainModel transformedDomainModel;
|
PomClassicDomainModel transformedDomainModel;
|
||||||
try {
|
try {
|
||||||
transformedDomainModel = ( (PomClassicDomainModel) ctx.transform( Arrays.asList( new PomClassicDomainModel(transformed), convertToDomainModel(model)),
|
transformedDomainModel = ( (PomClassicDomainModel) ctx.transform( Arrays.asList( new PomClassicDomainModel(transformed, false), convertToDomainModel(model, true)),
|
||||||
transformer,
|
transformer,
|
||||||
transformer,
|
transformer,
|
||||||
Collections.EMPTY_LIST,
|
Collections.EMPTY_LIST,
|
||||||
|
@ -619,8 +619,10 @@ public class DefaultMavenProjectBuilder
|
||||||
|
|
||||||
PomClassicDomainModel domainModel = new PomClassicDomainModel( pom );
|
PomClassicDomainModel domainModel = new PomClassicDomainModel( pom );
|
||||||
domainModel.setProjectDirectory( pom.getParentFile() );
|
domainModel.setProjectDirectory( pom.getParentFile() );
|
||||||
|
domainModel.setMostSpecialized(true);
|
||||||
|
|
||||||
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
List<DomainModel> domainModels = new ArrayList<DomainModel>();
|
||||||
domainModels.add( domainModel );
|
|
||||||
|
|
||||||
//Process Profile on most specialized child model
|
//Process Profile on most specialized child model
|
||||||
ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(domainModel.getModelProperties(),
|
ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(domainModel.getModelProperties(),
|
||||||
|
@ -640,9 +642,10 @@ public class DefaultMavenProjectBuilder
|
||||||
mp.getResolvedValue()));
|
mp.getResolvedValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
domainModels.add(new PomClassicDomainModel(transformed));
|
domainModels.add(new PomClassicDomainModel(transformed, false));
|
||||||
}
|
}
|
||||||
|
domainModels.add( domainModel );
|
||||||
|
|
||||||
File parentFile = null;
|
File parentFile = null;
|
||||||
int lineageCount = 0;
|
int lineageCount = 0;
|
||||||
if ( domainModel.getParentId() != null )
|
if ( domainModel.getParentId() != null )
|
||||||
|
@ -672,7 +675,7 @@ public class DefaultMavenProjectBuilder
|
||||||
domainModels.addAll( mavenParents );
|
domainModels.addAll( mavenParents );
|
||||||
}
|
}
|
||||||
|
|
||||||
domainModels.add( convertToDomainModel( getSuperModel() ) );
|
domainModels.add( convertToDomainModel( getSuperModel() , false ));
|
||||||
|
|
||||||
PomTransformer transformer = new PomTransformer( new PomClassicDomainModelFactory() );
|
PomTransformer transformer = new PomTransformer( new PomClassicDomainModelFactory() );
|
||||||
|
|
||||||
|
@ -691,7 +694,7 @@ public class DefaultMavenProjectBuilder
|
||||||
return transformedDomainModel;
|
return transformedDomainModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PomClassicDomainModel convertToDomainModel(Model model) throws IOException
|
private PomClassicDomainModel convertToDomainModel(Model model, boolean isMostSpecialized) throws IOException
|
||||||
{
|
{
|
||||||
if ( model == null )
|
if ( model == null )
|
||||||
{
|
{
|
||||||
|
@ -712,7 +715,7 @@ public class DefaultMavenProjectBuilder
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new PomClassicDomainModel(new ByteArrayInputStream(baos.toByteArray()));
|
return new PomClassicDomainModel(new ByteArrayInputStream(baos.toByteArray()), isMostSpecialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MavenProject buildFromLocalPath(File pom,
|
protected MavenProject buildFromLocalPath(File pom,
|
||||||
|
|
|
@ -119,14 +119,14 @@ public class PomConstructionTest
|
||||||
}
|
}
|
||||||
|
|
||||||
/*MNG-3900*/
|
/*MNG-3900*/
|
||||||
/*
|
|
||||||
public void testProfilePropertiesInterpolation()
|
public void testProfilePropertiesInterpolation()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
PomTestWrapper pom = buildPomFromMavenProject( "profile-properties-interpolation", "a" );
|
PomTestWrapper pom = buildPomFromMavenProject( "profile-properties-interpolation", "interpolation-profile" );
|
||||||
assertEquals("PASSED", pom.getValue("properties[1]/test"));
|
assertEquals("PASSED", pom.getValue("properties[1]/test"));
|
||||||
|
assertEquals("PASSED", pom.getValue("properties[1]/property"));
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// Some better conventions for the test poms needs to be created and each of these tests
|
// Some better conventions for the test poms needs to be created and each of these tests
|
||||||
// that represent a verification of a specification item needs to be a couple lines at most.
|
// that represent a verification of a specification item needs to be a couple lines at most.
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
<!-- This profile defines the properties to use for interpolation. -->
|
<!-- This profile defines the properties to use for interpolation. -->
|
||||||
<properties>
|
<properties>
|
||||||
<test>PASSED</test>
|
<test>PASSED</test>
|
||||||
|
<test1>PASSED</test1>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
Loading…
Reference in New Issue