From bdecdcf64a39c0375e9e00020ee7b0f1e388b5ec Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Mon, 17 May 2010 18:39:46 +0000 Subject: [PATCH] [MNG-4677] [regression] Plugin configuration incorrectly inherited from parent pom git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@945294 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultInheritanceAssembler.java | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java index afa3b75319..892017ad72 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/inheritance/DefaultInheritanceAssembler.java @@ -122,15 +122,18 @@ public class DefaultInheritanceAssembler for ( Plugin element : src ) { - Object key = getPluginKey( element ); + if ( element.isInherited() || !element.getExecutions().isEmpty() ) + { + // NOTE: Enforce recursive merge to trigger merging/inheritance logic for executions + Plugin plugin = new Plugin(); + plugin.setGroupId( element.getGroupId() ); + plugin.setArtifactId( element.getArtifactId() ); + mergePlugin( plugin, element, sourceDominant, context ); - // NOTE: Enforce recursive merge to trigger merging/inheritance logic for executions - Plugin plugin = new Plugin(); - plugin.setGroupId( element.getGroupId() ); - plugin.setArtifactId( element.getArtifactId() ); - mergePlugin( plugin, element, sourceDominant, context ); + Object key = getPluginKey( element ); - master.put( key, plugin ); + master.put( key, plugin ); + } } Map> predecessors = new LinkedHashMap>(); @@ -173,6 +176,21 @@ public class DefaultInheritanceAssembler } } + @Override + protected void mergePlugin( Plugin target, Plugin source, boolean sourceDominant, Map context ) + { + if ( source.isInherited() ) + { + mergeConfigurationContainer( target, source, sourceDominant, context ); + } + mergePlugin_GroupId( target, source, sourceDominant, context ); + mergePlugin_ArtifactId( target, source, sourceDominant, context ); + mergePlugin_Version( target, source, sourceDominant, context ); + mergePlugin_Extensions( target, source, sourceDominant, context ); + mergePlugin_Dependencies( target, source, sourceDominant, context ); + mergePlugin_Executions( target, source, sourceDominant, context ); + } + @Override protected void mergeReporting_Plugins( Reporting target, Reporting source, boolean sourceDominant, Map context )