You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christian Schulte (JIRA)" <ji...@apache.org> on 2015/12/20 01:23:46 UTC

[jira] [Commented] (MNG-5359) Declared execution in PluginMgmt gets bound to lifecycle (regression)

    [ https://issues.apache.org/jira/browse/MNG-5359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15065583#comment-15065583 ] 

Christian Schulte commented on MNG-5359:
----------------------------------------

The cause of this is the way 'org.apache.maven.model.plugin.DefaultLifecycleBindingsInjector' injects plugins. It will use the plugins of the lifecycle corresponding to the packaging of the project and all plugins of all lifecycles declaring default phases. That is the 'clean' lifecycle and the 'site' lifecycle. The 'clean' lifecycle has

{code}
        <default-phases>
          <clean>
            org.apache.maven.plugins:maven-clean-plugin:2.5:clean
          </clean>
        </default-phases>
{code}

and the 'site' lifecycle has

 {code}
        <default-phases>
          <site>
            org.apache.maven.plugins:maven-site-plugin:3.3:site
          </site>
          <site-deploy>
            org.apache.maven.plugins:maven-site-plugin:3.3:deploy
          </site-deploy>
        </default-phases>
{code}

The only plugins added to 'build/plugins/plugin' and thus merged with any plugin management should be the plugins requested to be executed by the user. Class 'org.apache.maven.lifecycle.Lifecycle' declares:

{code}
    public Map<String, LifecyclePhase> getDefaultLifecyclePhases()
    {
        return defaultPhases;
    }
    
    @Deprecated
    public Map<String, String> getDefaultPhases()
    {
        return LifecyclePhase.toLegacyMap( getDefaultLifecyclePhases() );
    }
{code}

The only usage of these methods is in class 'DefaultLifecycleBindingsInjector'.  Can someone explain what 'Lifecycle.getDefaultLifecyclePhases()' and 'Lifecycle.getDefaultPhases()' is/was used for? Is this the only use case?

> Declared execution in PluginMgmt gets bound to lifecycle (regression)
> ---------------------------------------------------------------------
>
>                 Key: MNG-5359
>                 URL: https://issues.apache.org/jira/browse/MNG-5359
>             Project: Maven
>          Issue Type: Bug
>          Components: Plugins and Lifecycle
>    Affects Versions: 3.0.1, 3.0.2, 3.0.3, 3.0.4
>         Environment: Mac OS 10.7.5, Apple JDK 1.6.0_35
> (Same behavior seen on Windows XP with Sun JDK 1.6.0 as well)
>            Reporter: Anders Hammar
>            Assignee: Christian Schulte
>         Attachments: MNG-5359-IT.patch, binding-test.zip
>
>
> If a plugin execution binding is declared in pluginManagement it gets bound to the build lifecycle in Maven 3.0.x, but not with Maven 2.2.1.
> My understanding is that the behavior in Maven 3.0 is wrong; an execution binding needs to be declared in build/plugins/plugin to be bound.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)