From 8e53ed0f659d6be83b284fc67a97348460e4e59f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Mon, 31 Mar 2014 21:44:47 +0200 Subject: [PATCH] disable interpolation on full profile activation, not only file based --- .../model/building/DefaultModelBuilder.java | 43 ++++++------------- 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java index 12b458ec45..c301856b3d 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java @@ -31,7 +31,6 @@ import java.util.HashMap; import java.util.Properties; import org.apache.maven.model.Activation; -import org.apache.maven.model.ActivationFile; import org.apache.maven.model.Build; import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; @@ -286,8 +285,8 @@ public class DefaultModelBuilder profileSelector.getActiveProfiles( rawModel.getProfiles(), profileActivationContext, problems ); currentData.setActiveProfiles( activePomProfiles ); - Map interpolatedActivationFiles = getProfileActivationFiles( rawModel, false ); - injectProfileActivationFiles( tmpModel, interpolatedActivationFiles ); + Map interpolatedActivations = getProfileActivations( rawModel, false ); + injectProfileActivations( tmpModel, interpolatedActivations ); for ( Profile activeProfile : activePomProfiles ) { @@ -642,9 +641,9 @@ public class DefaultModelBuilder } } - private Map getProfileActivationFiles( Model model, boolean clone ) + private Map getProfileActivations( Model model, boolean clone ) { - Map activationFiles = new HashMap(); + Map activations = new HashMap(); for ( Profile profile : model.getProfiles() ) { Activation activation = profile.getActivation(); @@ -654,25 +653,18 @@ public class DefaultModelBuilder continue; } - ActivationFile file = activation.getFile(); - - if ( file == null ) - { - continue; - } - if ( clone ) { - file = file.clone(); + activation = activation.clone(); } - activationFiles.put( profile.getId(), file ); + activations.put( profile.getId(), activation ); } - return activationFiles; + return activations; } - private void injectProfileActivationFiles( Model model, Map activationFiles ) + private void injectProfileActivations( Model model, Map activations ) { for ( Profile profile : model.getProfiles() ) { @@ -683,30 +675,21 @@ public class DefaultModelBuilder continue; } - ActivationFile file = activation.getFile(); - - if ( file == null ) - { - continue; - } - - // restore file specification - ActivationFile originalFile = activationFiles.get( profile.getId() ); - file.setExists( originalFile.getExists() ); - file.setMissing( originalFile.getMissing() ); + // restore activation + profile.setActivation( activations.get( profile.getId() ) ); } } private Model interpolateModel( Model model, ModelBuildingRequest request, ModelProblemCollector problems ) { - // save profiles with file activation before interpolation, since they are evaluated with limited scope - Map originalActivationFiles = getProfileActivationFiles( model, true ); + // save profile activations before interpolation, since they are evaluated with limited scope + Map originalActivations = getProfileActivations( model, true ); Model result = modelInterpolator.interpolateModel( model, model.getProjectDirectory(), request, problems ); result.setPomFile( model.getPomFile() ); // restore profiles with file activation to their value before full interpolation - injectProfileActivationFiles( model, originalActivationFiles ); + injectProfileActivations( model, originalActivations ); return result; }