o trying to merge manually

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@768842 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-04-27 00:43:53 +00:00
parent aafe040406
commit 2805dee2cf
3 changed files with 30 additions and 15 deletions

View File

@ -93,7 +93,7 @@ public class ProcessorContext
new RepositoriesProcessor(), new DistributionManagementProcessor(),
new LicensesProcessor(), new ScmProcessor(), new PrerequisitesProcessor(),
new ContributorsProcessor(), new DevelopersProcessor(), new ProfilesProcessor() );
Model target = processModelsForInheritance( convertDomainModelsToMavenModels( domainModels ), processors );
Model target = processModelsForInheritance( convertDomainModelsToMavenModels( domainModels ), processors, false );
if(listeners != null)
{
for(ModelEventListener listener : listeners)
@ -148,7 +148,7 @@ public class ProcessorContext
DependencyManagement depMng = model.getDependencyManagement();
Model target = processModelsForInheritance(profileModels, processors);
Model target = processModelsForInheritance(profileModels, processors, true);
PluginsManagementProcessor pmp = new PluginsManagementProcessor();
if( mng != null )
@ -219,9 +219,9 @@ public class ProcessorContext
return models;
}
private static Model processModelsForInheritance(List<Model> models, List<Processor> processors)
private static Model processModelsForInheritance(List<Model> models, List<Processor> processors, boolean isProfile)
{
ModelProcessor modelProcessor = new ModelProcessor( processors );
ModelProcessor modelProcessor = new ModelProcessor( processors, isProfile );
Collections.reverse( models );
int length = models.size();
@ -251,6 +251,14 @@ public class ProcessorContext
}
}
}
return target;
}
public static Model processManagementNodes(Model target)
throws IOException
{
// Dependency Management
DependencyManagementProcessor depProc = new DependencyManagementProcessor();
@ -261,16 +269,14 @@ public class ProcessorContext
}
// Plugin Management
PluginsManagementProcessor procMng = new PluginsManagementProcessor();
if ( target.getBuild() != null && target.getBuild().getPluginManagement() != null)
{
procMng.process( null, new ArrayList<Plugin>( target.getBuild().getPluginManagement().getPlugins() ),
target.getBuild().getPlugins(), true );
}
return target;
return target;
}
public static Profile copyOfProfile(Profile profile)

View File

@ -167,10 +167,7 @@ public class DependencyProcessor
targetDependency.setGroupId( source.getGroupId() );
}
if (isMatch(source.getScope(), targetDependency.getScope(), isDependencyManagement) )
{
targetDependency.setScope( source.getScope() );
}
targetDependency.setScope( source.getScope() );
if ( isMatch(source.getSystemPath(), targetDependency.getSystemPath(), isDependencyManagement) )
{

View File

@ -37,9 +37,12 @@ public class ModelProcessor
extends BaseProcessor
{
public ModelProcessor( Collection<Processor> processors )
private boolean isProfile;
public ModelProcessor( Collection<Processor> processors, boolean isProfile )
{
super( processors );
this.isProfile = isProfile;
}
public void process( Object parent, Object child, Object target, boolean isChildMostSpecialized )
@ -146,8 +149,17 @@ public class ModelProcessor
if(deps.size() > 0)
{
t.setDependencies(deps);
// t.getDependencies().addAll( deps );
//Multiple profiles may be processed so we need to add them
if(isProfile)
{
t.getDependencies().addAll( deps );
}
else
{
t.setDependencies(deps);
}
//
}
//Dependency Management