}
profileProps.putAll( profileActivationContext.getUserProperties() );
profileActivationContext.setUserProperties( profileProps );
}
Model inputModel = readModel( request.getModelSource(), request.getPomFile(), request, problems );
problems.setRootModel( inputModel );
ModelData resultData = new ModelData( inputModel );
ModelData superData = new ModelData( getSuperModel() );
Collection<String> parentIds = new LinkedHashSet<String>();
parentIds.add( ModelProblemUtils.toId( inputModel ) );
List<ModelData> lineage = new ArrayList<ModelData>();
for ( ModelData currentData = resultData; currentData != null; )
{
lineage.add( currentData );
Model tmpModel = currentData.getModel();
Model rawModel = tmpModel.clone();
currentData.setRawModel( rawModel );
problems.setSource( tmpModel );
modelNormalizer.mergeDuplicates( tmpModel, request, problems );
List<Profile> activePomProfiles =
profileSelector.getActiveProfiles( rawModel.getProfiles(), profileActivationContext, problems );
currentData.setActiveProfiles( activePomProfiles );
for ( Profile activeProfile : activePomProfiles )
{
profileInjector.injectProfile( tmpModel, activeProfile, request, problems );
}
if ( currentData == resultData )
{
for ( Profile activeProfile : activeExternalProfiles )
{
profileInjector.injectProfile( tmpModel, activeProfile, request, problems );
}
}
if ( currentData == superData )
{
break;
}
configureResolver( request.getModelResolver(), tmpModel, problems );
currentData = readParent( tmpModel, request, problems );
if ( currentData == null )
{
currentData = superData;
}
else if ( !parentIds.add( currentData.getId() ) )
{
String message = "The parents form a cycle: ";
for ( String modelId : parentIds )
{
message += modelId + " -> ";
}
message += currentData.getId();
problems.add( ModelProblem.Severity.FATAL, message, null, null );
throw new ModelBuildingException( problems.getRootModel(), problems.getRootModelId(),
problems.getProblems() );
}
}
problems.setSource( inputModel );
checkPluginVersions( lineage, request, problems );
assembleInheritance( lineage, request, problems );
Model resultModel = resultData.getModel();
problems.setSource( resultModel );
problems.setRootModel( resultModel );
resultModel = interpolateModel( resultModel, request, problems );
resultData.setModel( resultModel );
modelUrlNormalizer.normalize( resultModel, request );
resultData.setGroupId( resultModel.getGroupId() );
resultData.setArtifactId( resultModel.getArtifactId() );
resultData.setVersion( resultModel.getVersion() );
result.setProblems( problems.getProblems() );
result.setEffectiveModel( resultModel );