simple recognition of plugin for current type

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163427 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-02-27 23:47:29 +00:00
parent 6aed331a91
commit 1d2c0d1d46
1 changed files with 23 additions and 13 deletions

View File

@ -76,6 +76,9 @@ public MavenExecutionResponse execute( List tasks, MavenSession session )
try
{
// TODO: should enrich this with the type handler, but for now just use "type" as is
processPluginPhases( session.getProject().getType(), session );
processPluginConfiguration( session.getProject(), session );
processGoalChain( tasks, session );
@ -124,20 +127,27 @@ private void processPluginConfiguration( MavenProject project, MavenSession mave
// TODO: should this flag be used in verifyPlugin, completely disabling the plugin?
if ( !plugin.isDisabled() )
{
if ( pluginManager.verifyPlugin( plugin.getId(), mavenSession ) )
{
PluginDescriptor pluginDescriptor = pluginManager.getPluginDescriptor( plugin.getId() );
for ( Iterator j = pluginDescriptor.getMojos().iterator(); j.hasNext(); )
{
MojoDescriptor mojoDescriptor = (MojoDescriptor) j.next();
String pluginId = plugin.getId();
processPluginPhases( pluginId, mavenSession );
}
}
}
// TODO: check if the goal exists in the configuration and is disabled
if ( mojoDescriptor.getPhase() != null )
{
Phase phase = (Phase) phaseMap.get( mojoDescriptor.getPhase() );
phase.getGoals().add( mojoDescriptor.getId() );
}
}
private void processPluginPhases( String pluginId, MavenSession mavenSession )
throws Exception
{
if ( pluginManager.verifyPlugin( pluginId, mavenSession ) )
{
PluginDescriptor pluginDescriptor = pluginManager.getPluginDescriptor( pluginId );
for ( Iterator j = pluginDescriptor.getMojos().iterator(); j.hasNext(); )
{
MojoDescriptor mojoDescriptor = (MojoDescriptor) j.next();
// TODO: check if the goal exists in the configuration and is disabled
if ( mojoDescriptor.getPhase() != null )
{
Phase phase = (Phase) phaseMap.get( mojoDescriptor.getPhase() );
phase.getGoals().add( mojoDescriptor.getId() );
}
}
}