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:27:21 UTC

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

     [ 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