mirror of https://github.com/apache/maven.git
[MNG-5477] finally removed reporting plugin version validation since a
warning is issued in maven-site-plugin in case of missing version. Then removed reporting plugin version injection too
This commit is contained in:
parent
00b9029094
commit
f34b4fbdfc
|
@ -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<PluginExecution>( merged.values() ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* merge plugin version to reporting if report plugin version not set
|
||||
*/
|
||||
private void mergeReporting_Plugins( Reporting target, PluginContainer source )
|
||||
{
|
||||
List<Plugin> src = source.getPlugins();
|
||||
if ( !src.isEmpty() )
|
||||
{
|
||||
List<ReportPlugin> tgt = target.getPlugins();
|
||||
|
||||
Map<Object, Plugin> managedPlugins = new LinkedHashMap<Object, Plugin>( 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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue