mirror of https://github.com/apache/maven.git
[MNG-5350] improved warning message: when in debug mode, list the goals and not only the plugins
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1398044 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6926782cca
commit
23097a37a0
|
@ -32,6 +32,7 @@ import java.util.Set;
|
|||
import org.apache.maven.lifecycle.internal.ExecutionPlanItem;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.plugin.MojoExecution;
|
||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||
|
||||
//TODO: lifecycles being executed
|
||||
//TODO: what runs in each phase
|
||||
|
@ -170,7 +171,11 @@ public class MavenExecutionPlan
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get set of plugins having a goal/mojo used but not marked @threadSafe
|
||||
*
|
||||
* @return the set of plugins (without info on which goal is concerned)
|
||||
*/
|
||||
public Set<Plugin> getNonThreadSafePlugins()
|
||||
{
|
||||
Set<Plugin> plugins = new HashSet<Plugin>();
|
||||
|
@ -185,6 +190,25 @@ public class MavenExecutionPlan
|
|||
return plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get set of mojos used but not marked @threadSafe
|
||||
*
|
||||
* @return the set of mojo descriptors
|
||||
*/
|
||||
public Set<MojoDescriptor> getNonThreadSafeMojos()
|
||||
{
|
||||
Set<MojoDescriptor> mojos = new HashSet<MojoDescriptor>();
|
||||
for ( ExecutionPlanItem executionPlanItem : planItem )
|
||||
{
|
||||
final MojoExecution mojoExecution = executionPlanItem.getMojoExecution();
|
||||
if ( !mojoExecution.getMojoDescriptor().isThreadSafe() )
|
||||
{
|
||||
mojos.add( mojoExecution.getMojoDescriptor() );
|
||||
}
|
||||
}
|
||||
return mojos;
|
||||
}
|
||||
|
||||
// Used by m2e but will be removed, really.
|
||||
@Deprecated
|
||||
public List<MojoExecution> getExecutions()
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.apache.maven.plugin.MojoNotFoundException;
|
|||
import org.apache.maven.plugin.PluginDescriptorParsingException;
|
||||
import org.apache.maven.plugin.PluginNotFoundException;
|
||||
import org.apache.maven.plugin.PluginResolutionException;
|
||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||
import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
|
||||
import org.apache.maven.plugin.version.PluginVersionResolutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
@ -69,7 +70,6 @@ public class BuilderCommon
|
|||
private Logger logger;
|
||||
|
||||
|
||||
@SuppressWarnings( { "UnusedDeclaration" } )
|
||||
public BuilderCommon()
|
||||
{
|
||||
}
|
||||
|
@ -101,17 +101,30 @@ public class BuilderCommon
|
|||
{
|
||||
logger.warn( "*****************************************************************" );
|
||||
logger.warn( "* Your build is requesting parallel execution, but project *" );
|
||||
logger.warn( "* contains the following plugin(s) that are not marked as *" );
|
||||
logger.warn( "* @threadSafe to support parallel building. *" );
|
||||
logger.warn( "* contains the following plugin(s) that have goals not marked *" );
|
||||
logger.warn( "* as @threadSafe to support parallel building. *" );
|
||||
logger.warn( "* While this /may/ work fine, please look for plugin updates *" );
|
||||
logger.warn( "* and/or request plugins be made thread-safe. *" );
|
||||
logger.warn( "* If reporting an issue, report it against the plugin in *" );
|
||||
logger.warn( "* question, not against maven-core *" );
|
||||
logger.warn( "*****************************************************************" );
|
||||
logger.warn( "The following plugins are not marked @threadSafe in " + project.getName() + ":" );
|
||||
for ( Plugin unsafePlugin : unsafePlugins )
|
||||
if ( logger.isDebugEnabled() )
|
||||
{
|
||||
logger.warn( unsafePlugin.getId() );
|
||||
final Set<MojoDescriptor> unsafeGoals = executionPlan.getNonThreadSafeMojos();
|
||||
logger.warn( "The following goals are not marked @threadSafe in " + project.getName() + ":" );
|
||||
for ( MojoDescriptor unsafeGoal : unsafeGoals )
|
||||
{
|
||||
logger.warn( unsafeGoal.getId() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn( "The following plugins are not marked @threadSafe in " + project.getName() + ":" );
|
||||
for ( Plugin unsafePlugin : unsafePlugins )
|
||||
{
|
||||
logger.warn( unsafePlugin.getId() );
|
||||
}
|
||||
logger.warn( "Enable debug to see more precisely which goals are not marked @threadSafe." );
|
||||
}
|
||||
logger.warn( "*****************************************************************" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue