diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java b/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java index abd8d94dfc..a13d4fd118 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/management/DefaultPluginManagementInjector.java @@ -31,8 +31,6 @@ import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginContainer; import org.apache.maven.model.PluginExecution; import org.apache.maven.model.PluginManagement; -import org.apache.maven.model.ReportPlugin; -import org.apache.maven.model.Reporting; import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.model.building.ModelProblemCollector; import org.apache.maven.model.merge.MavenModelMerger; @@ -69,12 +67,6 @@ public class DefaultPluginManagementInjector { mergePluginContainer_Plugins( build, pluginManagement ); } - - mergeReporting_Plugins( model.getReporting(), build ); - if ( pluginManagement != null ) - { - mergeReporting_Plugins( model.getReporting(), pluginManagement ); - } } } @@ -139,36 +131,6 @@ public class DefaultPluginManagementInjector target.setExecutions( new ArrayList( merged.values() ) ); } } - - /** - * merge plugin version to reporting if report plugin version not set - */ - private void mergeReporting_Plugins( Reporting target, PluginContainer source ) - { - List src = source.getPlugins(); - if ( !src.isEmpty() ) - { - List tgt = target.getPlugins(); - - Map managedPlugins = new LinkedHashMap( src.size() * 2 ); - - for ( Plugin element : src ) - { - Object key = getPluginKey( element ); - managedPlugins.put( key, element ); - } - - for ( ReportPlugin element : tgt ) - { - Object key = getReportPluginKey( element ); - Plugin managedPlugin = managedPlugins.get( key ); - if ( managedPlugin != null && element.getVersion() == null ) - { - element.setVersion( managedPlugin.getVersion() ); - } - } - } - } } } diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java index 77219a7b04..a1dbb47f38 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java @@ -316,9 +316,6 @@ public class DefaultModelValidator validateStringNotEmpty( "reporting.plugins.plugin.groupId", problems, Severity.ERROR, Version.V20, p.getGroupId(), p ); - - validateStringNotEmpty( "reporting.plugins.plugin.version", problems, errOn31, Version.V20, p.getVersion(), - p.getKey(), p ); } } diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java index c093804887..7af3ee55d5 100644 --- a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java +++ b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java @@ -27,7 +27,6 @@ import org.apache.maven.model.building.DefaultModelBuildingRequest; import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.model.building.SimpleProblemCollector; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.apache.maven.model.management.PluginManagementInjector; import org.codehaus.plexus.PlexusTestCase; /** @@ -39,8 +38,6 @@ public class DefaultModelValidatorTest private ModelValidator validator; - private PluginManagementInjector pluginManagementInjector; - private Model read( String pom ) throws Exception { @@ -74,19 +71,6 @@ public class DefaultModelValidatorTest return problems; } - private SimpleProblemCollector validateEffective( Model model ) - throws Exception - { - ModelBuildingRequest request = - new DefaultModelBuildingRequest().setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_STRICT ); - - SimpleProblemCollector problems = new SimpleProblemCollector( model ); - - validator.validateEffectiveModel( problems.getModel(), request, problems ); - - return problems; - } - private SimpleProblemCollector validateRaw( String pom, int level ) throws Exception { @@ -111,14 +95,12 @@ public class DefaultModelValidatorTest super.setUp(); validator = lookup( ModelValidator.class ); - pluginManagementInjector = lookup( PluginManagementInjector.class ); } @Override protected void tearDown() throws Exception { - this.pluginManagementInjector = null; this.validator = null; super.tearDown(); @@ -636,28 +618,6 @@ public class DefaultModelValidatorTest { SimpleProblemCollector result = validate( "missing-report-version-pom.xml" ); - assertViolations( result, 0, 0, 3 ); - - assertContains( result.getWarnings().get( 0 ), - "'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-noversion-plugin is missing." ); - assertContains( result.getWarnings().get( 1 ), - "'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-from-plugins-plugin is missing." ); - assertContains( result.getWarnings().get( 2 ), - "'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-from-pluginManagement-plugin is missing." ); - - // after pluginManagement injection - ModelBuildingRequest request = - new DefaultModelBuildingRequest().setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_STRICT ); - - SimpleProblemCollector problems = new SimpleProblemCollector(); - - pluginManagementInjector.injectManagement( result.getModel(), request, problems ); - - result = validateEffective( result.getModel() ); - - assertViolations( result, 0, 0, 1 ); - - assertContains( result.getWarnings().get( 0 ), - "'reporting.plugins.plugin.version' for org.apache.maven.plugins:maven-noversion-plugin is missing." ); + assertViolations( result, 0, 0, 0 ); } }