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

        

Reply via email to