You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/05/11 22:56:33 UTC
svn commit: r773692 - in /maven/components/branches/MNG-2766:
maven-core/src/main/java/org/apache/maven/project/
maven-model-builder/src/main/java/org/apache/maven/model/plugin/
Author: bentmann
Date: Mon May 11 20:56:32 2009
New Revision: 773692
URL: http://svn.apache.org/viewvc?rev=773692&view=rev
Log:
o Moved expansion of plugin configuration into component
Added:
maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/ (with props)
maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java (with props)
maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java (with props)
Modified:
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=773692&r1=773691&r2=773692&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java (original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java Mon May 11 20:56:32 2009
@@ -44,6 +44,7 @@
import org.apache.maven.model.interpolator.Interpolator;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.model.lifecycle.LifecycleBindingsInjector;
+import org.apache.maven.model.plugin.PluginConfigurationExpander;
import org.apache.maven.profiles.DefaultProfileManager;
import org.apache.maven.profiles.ProfileActivationException;
import org.apache.maven.profiles.ProfileManager;
@@ -88,6 +89,9 @@
private LifecycleBindingsInjector lifecycleBindingsInjector;
@Requirement
+ private PluginConfigurationExpander pluginConfigurationExpander;
+
+ @Requirement
private ResolutionErrorHandler resolutionErrorHandler;
@Requirement
@@ -168,34 +172,11 @@
project = this.fromDomainModelToMavenProject( model, domainModel.getParentFile(), configuration, pomFile );
if ( configuration.isProcessPlugins() )
- {
- Collection<Plugin> pluginsFromProject = project.getModel().getBuild().getPlugins();
-
- // Merge the various sources for mojo configuration:
- // 1. default values from mojo descriptor
- // 2. POM values from per-plugin configuration
- // 3. POM values from per-execution configuration
- // These configuration sources are given in increasing order of dominance.
-
- // push plugin configuration down to executions
- for ( Plugin buildPlugin : pluginsFromProject )
- {
- Xpp3Dom dom = (Xpp3Dom) buildPlugin.getConfiguration();
-
- if ( dom != null )
- {
- for ( PluginExecution e : buildPlugin.getExecutions() )
- {
- Xpp3Dom dom1 = Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) e.getConfiguration(), new Xpp3Dom( dom ) );
- e.setConfiguration( dom1 );
- }
- }
- }
-
- // merge in default values from mojo descriptor
- lifecycle.populateDefaultConfigurationForPlugins( pluginsFromProject, project, configuration.getLocalRepository() );
+ {
+ pluginConfigurationExpander.expandPluginConfiguration( project.getModel() );
- project.getModel().getBuild().setPlugins( new ArrayList<Plugin>( pluginsFromProject ) );
+ lifecycle.populateDefaultConfigurationForPlugins( project.getModel().getBuild().getPlugins(), project,
+ configuration.getLocalRepository() );
}
}
catch ( IOException e )
Propchange: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/
------------------------------------------------------------------------------
bugtraq:label = Enter issue ID:
Propchange: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/
------------------------------------------------------------------------------
bugtraq:message = Issue id: %BUGID%
Propchange: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/
------------------------------------------------------------------------------
bugtraq:number = false
Propchange: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/
------------------------------------------------------------------------------
bugtraq:url = http://jira.codehaus.org/browse/%BUGID%
Added: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java?rev=773692&view=auto
==============================================================================
--- maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java (added)
+++ maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java Mon May 11 20:56:32 2009
@@ -0,0 +1,84 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.ReportSet;
+import org.apache.maven.model.Reporting;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+/**
+ * Handles expansion of general plugin configuration into individual executions and report sets.
+ *
+ * @author Benjamin Bentmann
+ */
+@Component( role = PluginConfigurationExpander.class )
+public class DefaultPluginConfigurationExpander
+ implements PluginConfigurationExpander
+{
+
+ public void expandPluginConfiguration( Model model )
+ {
+ Build build = model.getBuild();
+ Reporting reporting = model.getReporting();
+
+ if ( build != null )
+ {
+ for ( Plugin buildPlugin : build.getPlugins() )
+ {
+ Xpp3Dom parentDom = (Xpp3Dom) buildPlugin.getConfiguration();
+
+ if ( parentDom != null )
+ {
+ for ( PluginExecution execution : buildPlugin.getExecutions() )
+ {
+ Xpp3Dom childDom = (Xpp3Dom) execution.getConfiguration();
+ childDom = Xpp3Dom.mergeXpp3Dom( childDom, new Xpp3Dom( parentDom ) );
+ execution.setConfiguration( childDom );
+ }
+ }
+ }
+ }
+
+ if ( reporting != null )
+ {
+ for ( ReportPlugin reportPlugin : reporting.getPlugins() )
+ {
+ Xpp3Dom parentDom = (Xpp3Dom) reportPlugin.getConfiguration();
+
+ if ( parentDom != null )
+ {
+ for ( ReportSet execution : reportPlugin.getReportSets() )
+ {
+ Xpp3Dom childDom = (Xpp3Dom) execution.getConfiguration();
+ childDom = Xpp3Dom.mergeXpp3Dom( childDom, new Xpp3Dom( parentDom ) );
+ execution.setConfiguration( childDom );
+ }
+ }
+ }
+ }
+ }
+
+}
Propchange: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/DefaultPluginConfigurationExpander.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java?rev=773692&view=auto
==============================================================================
--- maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java (added)
+++ maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java Mon May 11 20:56:32 2009
@@ -0,0 +1,40 @@
+package org.apache.maven.model.plugin;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.model.Model;
+
+/**
+ * Handles expansion of general plugin configuration into individual executions and report sets.
+ *
+ * @author Benjamin Bentmann
+ */
+public interface PluginConfigurationExpander
+{
+
+ /**
+ * Merges values from general plugin configuration into the individual plugin executions and reports sets of the
+ * given model.
+ *
+ * @param model The model whose plugin configuration should be expanded, must not be <code>null</code>.
+ */
+ void expandPluginConfiguration( Model model );
+
+}
Propchange: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/branches/MNG-2766/maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision