mirror of https://github.com/apache/maven.git
avoid NPE if there are not report plugins defined in the POM when generating the site.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@168565 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
57284e462c
commit
3f031d5722
|
@ -200,7 +200,7 @@ public class DefaultLifecycleExecutor
|
|||
private void processPluginConfiguration( MavenProject project, MavenSession mavenSession, Map phaseMap )
|
||||
throws LifecycleExecutionException, ArtifactResolutionException
|
||||
{
|
||||
for ( Iterator i = project.getPlugins().iterator(); i.hasNext(); )
|
||||
for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
|
||||
{
|
||||
Plugin plugin = (Plugin) i.next();
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ public class DefaultPluginManager
|
|||
|
||||
org.apache.maven.model.Plugin pluginConfig = null;
|
||||
|
||||
for ( Iterator it = project.getPlugins().iterator(); it.hasNext(); )
|
||||
for ( Iterator it = project.getBuildPlugins().iterator(); it.hasNext(); )
|
||||
{
|
||||
org.apache.maven.model.Plugin plugin = (org.apache.maven.model.Plugin) it.next();
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
|
|||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||
|
@ -84,11 +85,15 @@ public class PluginParameterExpressionEvaluator
|
|||
try
|
||||
{
|
||||
PluginManager pluginManager = (PluginManager) context.lookup( role );
|
||||
for ( Iterator it = context.getProject().getReports().getPlugins().iterator(); it.hasNext(); )
|
||||
List reportPlugins = context.getProject().getReportPlugins();
|
||||
if ( reportPlugins != null )
|
||||
{
|
||||
org.apache.maven.model.Plugin plugin = (org.apache.maven.model.Plugin) it.next();
|
||||
pluginManager.verifyPlugin( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
|
||||
context );
|
||||
for ( Iterator it = reportPlugins.iterator(); it.hasNext(); )
|
||||
{
|
||||
org.apache.maven.model.Plugin plugin = (org.apache.maven.model.Plugin) it.next();
|
||||
pluginManager.verifyPlugin( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
|
||||
context );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( ComponentLookupException cle )
|
||||
|
|
|
@ -677,7 +677,16 @@ public class MavenProject
|
|||
// Plugins
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
public List getPlugins()
|
||||
public List getReportPlugins()
|
||||
{
|
||||
if ( model.getReports() == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return model.getReports().getPlugins();
|
||||
|
||||
}
|
||||
public List getBuildPlugins()
|
||||
{
|
||||
if ( model.getBuild() == null )
|
||||
{
|
||||
|
@ -811,9 +820,9 @@ public class MavenProject
|
|||
// for now I have to iterate through and see what we have.
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
if ( getPlugins() != null )
|
||||
if ( getBuildPlugins() != null )
|
||||
{
|
||||
for ( Iterator iterator = getPlugins().iterator(); iterator.hasNext(); )
|
||||
for ( Iterator iterator = getBuildPlugins().iterator(); iterator.hasNext(); )
|
||||
{
|
||||
Plugin plugin = (Plugin) iterator.next();
|
||||
|
||||
|
@ -845,4 +854,5 @@ public class MavenProject
|
|||
{
|
||||
return model.getPluginRepositories();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class CanonicalProjectBuilderTest
|
|||
// Plugins
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
List plugins = project.getPlugins();
|
||||
List plugins = project.getBuildPlugins();
|
||||
|
||||
// Plugin0 [plexus]
|
||||
|
||||
|
|
Loading…
Reference in New Issue