diff --git a/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java index ba608ce6c4..64e407801c 100644 --- a/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java +++ b/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java @@ -22,9 +22,11 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.ArtifactUtils; @@ -34,11 +36,13 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolutionRequest; import org.apache.maven.artifact.resolver.ArtifactResolutionResult; import org.apache.maven.artifact.resolver.ResolutionErrorHandler; +import org.apache.maven.lifecycle.LifecycleExecutionException; import org.apache.maven.lifecycle.LifecycleExecutor; import org.apache.maven.model.Build; import org.apache.maven.model.DomainModel; import org.apache.maven.model.Model; import org.apache.maven.model.ModelEventListener; +import org.apache.maven.model.Plugin; import org.apache.maven.model.ProcessorContext; import org.apache.maven.model.Profile; import org.apache.maven.model.interpolator.Interpolator; @@ -87,6 +91,13 @@ public class DefaultMavenProjectBuilder @Requirement private ResolutionErrorHandler resolutionErrorHandler; + //DO NOT USE, it is here only for backward compatibility reasons. The existing + // maven-assembly-plugin (2.2-beta-1) is accessing it via reflection. + + // the aspect weaving seems not to work for reflection from plugin. + + private Map processedProjectCache = new HashMap(); + private static HashMap hm = new HashMap(); private MavenProject superProject; @@ -161,15 +172,28 @@ public class DefaultMavenProjectBuilder //Interpolation & Management MavenProject project; - try { + try + { Model model = interpolateDomainModel( domainModel, configuration, pomFile ); - ProcessorContext.addPluginsToModel(model, lifecycle.getPluginsBoundByDefaultToAllLifecycles(model.getPackaging())); - + Set plugins = lifecycle.getPluginsBoundByDefaultToAllLifecycles(model.getPackaging()); + ProcessorContext.addPluginsToModel(model, plugins); ProcessorContext.processManagementNodes(model); project = this.fromDomainModelToMavenProject(model, domainModel.getParentFile(), configuration, pomFile); - } catch (IOException e) { + + plugins = lifecycle.populateDefaultConfigurationForPlugins(new HashSet(model.getBuild().getPlugins()), + project, configuration.getLocalRepository()); + + project.getModel().getBuild().setPlugins(new ArrayList(plugins)); + } + catch (IOException e) + { throw new ProjectBuildingException("", ""); } + catch (LifecycleExecutionException e) + { + e.printStackTrace(); + throw new ProjectBuildingException("",e.getMessage()); + } project.setActiveProfiles( projectProfiles ); @@ -184,7 +208,7 @@ public class DefaultMavenProjectBuilder setBuildOutputDirectoryOnParent( project ); hm.put( ArtifactUtils.artifactId( project.getGroupId(), project.getArtifactId(), "pom", project.getVersion() ), project ); - + return project; } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/ProcessorContext.java b/maven-model-builder/src/main/java/org/apache/maven/model/ProcessorContext.java index 915d51c1f5..c0c05a9d84 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/ProcessorContext.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/ProcessorContext.java @@ -275,7 +275,6 @@ public class ProcessorContext { if( !containsPlugin( p, mPlugins) ) { - p.setConfiguration(null); lifecyclePlugins.add(p); } }