You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jiaqi Guo (JIRA)" <ji...@codehaus.org> on 2007/02/14 06:24:28 UTC

[jira] Created: (MNG-2824) Value of parameter with expression=${plugin} is always null in Mojo

Value of parameter with expression=${plugin} is always null in Mojo
-------------------------------------------------------------------

                 Key: MNG-2824
                 URL: http://jira.codehaus.org/browse/MNG-2824
             Project: Maven 2
          Issue Type: Bug
          Components: Plugin API
    Affects Versions: 2.0.4, 2.0.3, 2.0.2, 2.0.1, 2.0
         Environment: I believe it happens everywhere since it's a logic problem in code
            Reporter: Jiaqi Guo


Parameter with expression="${plugin}" in a Mojo is always null at runtime. Looking at http://svn.apache.org/repos/asf/maven/components/tags/maven-2.0.4/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java, line 169 ~ 242, I realized that an "else if" check for "${plugin}" is missing. So if expression is "plugin", line 233 will be executed. expression.substring( 1 ) becomes "lugin" and pluginDescriptor.getLugin() will be called by ReflectionValueExtractor, and returns null because it's invalid. More detail has been discussed in mailing list: http://www.nabble.com/Can-anyone-explain-this-code-tf3218981s177.html

The fix is simple. I can just add another condition check for "plugin".equals(expression).

The problem has been there since 2.0 release but it doesn't exist in trunk. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MNG-2824) Value of parameter with expression=${plugin} is always null in Mojo

Posted by "Jiaqi Guo (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-2824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jiaqi Guo updated MNG-2824:
---------------------------

    Attachment: MNG-2824-maven-core.patch

Re-upload the patch with two more tests in TestCase

> Value of parameter with expression=${plugin} is always null in Mojo
> -------------------------------------------------------------------
>
>                 Key: MNG-2824
>                 URL: http://jira.codehaus.org/browse/MNG-2824
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4
>         Environment: I believe it happens everywhere since it's a logic problem in code
>            Reporter: Jiaqi Guo
>         Attachments: MNG-2824-maven-core.patch, MNG-2824-maven-core.patch
>
>
> Parameter with expression="${plugin}" in a Mojo is always null at runtime. Looking at http://svn.apache.org/repos/asf/maven/components/tags/maven-2.0.4/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java, line 169 ~ 242, I realized that an "else if" check for "${plugin}" is missing. So if expression is "plugin", line 233 will be executed. expression.substring( 1 ) becomes "lugin" and pluginDescriptor.getLugin() will be called by ReflectionValueExtractor, and returns null because it's invalid. More detail has been discussed in mailing list: http://www.nabble.com/Can-anyone-explain-this-code-tf3218981s177.html
> The fix is simple. I can just add another condition check for "plugin".equals(expression).
> The problem has been there since 2.0 release but it doesn't exist in trunk. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MNG-2824) Value of parameter with expression=${plugin} is always null in Mojo

Posted by "Jiaqi Guo (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-2824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jiaqi Guo updated MNG-2824:
---------------------------

    Attachment: MNG-2824-maven-core.patch

Add condition check for ${plugin} parameter expression

> Value of parameter with expression=${plugin} is always null in Mojo
> -------------------------------------------------------------------
>
>                 Key: MNG-2824
>                 URL: http://jira.codehaus.org/browse/MNG-2824
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4
>         Environment: I believe it happens everywhere since it's a logic problem in code
>            Reporter: Jiaqi Guo
>         Attachments: MNG-2824-maven-core.patch
>
>
> Parameter with expression="${plugin}" in a Mojo is always null at runtime. Looking at http://svn.apache.org/repos/asf/maven/components/tags/maven-2.0.4/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java, line 169 ~ 242, I realized that an "else if" check for "${plugin}" is missing. So if expression is "plugin", line 233 will be executed. expression.substring( 1 ) becomes "lugin" and pluginDescriptor.getLugin() will be called by ReflectionValueExtractor, and returns null because it's invalid. More detail has been discussed in mailing list: http://www.nabble.com/Can-anyone-explain-this-code-tf3218981s177.html
> The fix is simple. I can just add another condition check for "plugin".equals(expression).
> The problem has been there since 2.0 release but it doesn't exist in trunk. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-2824) Value of parameter with expression=${plugin} is always null in Mojo

Posted by "Laurent Fontvielle (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-2824?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_92264 ] 

Laurent Fontvielle commented on MNG-2824:
-----------------------------------------

It is possible to use the following workaround:

1.declare the parameter:
    /**
     * @parameter expression="${plugin.mojos}"
     * @required
     * @readonly
     */
    protected List pluginMojos;

2.In the plugin code, you can access the PluginDescriptor instance with this code:
       MojoDescriptor mojoDescriptor = (MojoDescriptor) pluginMojos.get(0);
       PluginDescriptor plugin = mojoDescriptor.getPluginDescriptor();
 


> Value of parameter with expression=${plugin} is always null in Mojo
> -------------------------------------------------------------------
>
>                 Key: MNG-2824
>                 URL: http://jira.codehaus.org/browse/MNG-2824
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4
>         Environment: I believe it happens everywhere since it's a logic problem in code
>            Reporter: Jiaqi Guo
>         Attachments: MNG-2824-maven-core.patch, MNG-2824-maven-core.patch
>
>
> Parameter with expression="${plugin}" in a Mojo is always null at runtime. Looking at http://svn.apache.org/repos/asf/maven/components/tags/maven-2.0.4/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java, line 169 ~ 242, I realized that an "else if" check for "${plugin}" is missing. So if expression is "plugin", line 233 will be executed. expression.substring( 1 ) becomes "lugin" and pluginDescriptor.getLugin() will be called by ReflectionValueExtractor, and returns null because it's invalid. More detail has been discussed in mailing list: http://www.nabble.com/Can-anyone-explain-this-code-tf3218981s177.html
> The fix is simple. I can just add another condition check for "plugin".equals(expression).
> The problem has been there since 2.0 release but it doesn't exist in trunk. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MNG-2824) Value of parameter with expression=${plugin} is always null in Mojo

Posted by "Jason van Zyl (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-2824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason van Zyl closed MNG-2824.
------------------------------

    Resolution: Won't Fix

We are looking for plugin.XXX expressions like ${plugin.artifacts}. ${plugin} itself doesn't mean anything.

> Value of parameter with expression=${plugin} is always null in Mojo
> -------------------------------------------------------------------
>
>                 Key: MNG-2824
>                 URL: http://jira.codehaus.org/browse/MNG-2824
>             Project: Maven 2
>          Issue Type: Bug
>          Components: Plugin API
>    Affects Versions: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4
>         Environment: I believe it happens everywhere since it's a logic problem in code
>            Reporter: Jiaqi Guo
>         Attachments: MNG-2824-maven-core.patch, MNG-2824-maven-core.patch
>
>
> Parameter with expression="${plugin}" in a Mojo is always null at runtime. Looking at http://svn.apache.org/repos/asf/maven/components/tags/maven-2.0.4/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java, line 169 ~ 242, I realized that an "else if" check for "${plugin}" is missing. So if expression is "plugin", line 233 will be executed. expression.substring( 1 ) becomes "lugin" and pluginDescriptor.getLugin() will be called by ReflectionValueExtractor, and returns null because it's invalid. More detail has been discussed in mailing list: http://www.nabble.com/Can-anyone-explain-this-code-tf3218981s177.html
> The fix is simple. I can just add another condition check for "plugin".equals(expression).
> The problem has been there since 2.0 release but it doesn't exist in trunk. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira