You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jiaqi Guo <cy...@gmail.com> on 2007/02/13 08:09:49 UTC

Can anyone explain this code

Hi there,

I'm trying to find out the build-in variables for a maven2 plugin and 
found the following code in 
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 217:

...
        else if ( expression.startsWith( "plugin" ) )
        {
            try
            {
                int pathSeparator = expression.indexOf( "/" );

                PluginDescriptor pluginDescriptor = 
mojoDescriptor.getPluginDescriptor();

                if ( pathSeparator > 0 )
                {
                    String pathExpression = expression.substring( 1, 
pathSeparator );
                    value = ReflectionValueExtractor.evaluate( 
pathExpression, pluginDescriptor );
                    value = value + expression.substring( pathSeparator );
                }
                else
                {
                    value = ReflectionValueExtractor.evaluate( 
expression.substring( 1 ), pluginDescriptor );
                }
            }
            catch ( Exception e )
            {
                // TODO: don't catch exception
                throw new ExpressionEvaluationException( "Error 
evaluating plugin parameter expression: " + expression,
                                                         e );
            }
        }
...

If I didn't miss anything this code make the value of any parameter 
expression starting with "plugin" to be null for sure, which will cause 
PluginParameterException in 
org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809). 
Same thing happens to "settings" and "project".

Is this a bug of maven-2.0.4? Is there any way to get pluginDescriptor 
in Mojo?



Regards

-- 


Jiaqi Guo

http://www.cyclopsgroup.org
jiaqi.guo@gmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Can anyone explain this code

Posted by Wayne Fay <wa...@gmail.com>.
Make sure you take a look at the relevant Plexus code before assuming
there's a problem with this bit of Maven code:

http://svn.plexus.codehaus.org/browse/~raw,r=1756/plexus/trunk/plexus-utils/src/main/java/org/codehaus/plexus/util/introspection/ReflectionValueExtractor.java

http://svn.plexus.codehaus.org/browse/~raw,r=1980/plexus/trunk/plexus-utils/src/main/java/org/codehaus/plexus/util/StringUtils.java

There's more, you'll just need to follow the import statements.

Wayne

On 2/13/07, Jiaqi Guo <cy...@gmail.com> wrote:
> Hi there,
>
> I'm trying to find out the build-in variables for a maven2 plugin and
> found the following code in
> 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 217:
>
> ...
>        else if ( expression.startsWith( "plugin" ) )
>        {
>            try
>            {
>                int pathSeparator = expression.indexOf( "/" );
>
>                PluginDescriptor pluginDescriptor =
> mojoDescriptor.getPluginDescriptor();
>
>                if ( pathSeparator > 0 )
>                {
>                    String pathExpression = expression.substring( 1,
> pathSeparator );
>                    value = ReflectionValueExtractor.evaluate(
> pathExpression, pluginDescriptor );
>                    value = value + expression.substring( pathSeparator );
>                }
>                else
>                {
>                    value = ReflectionValueExtractor.evaluate(
> expression.substring( 1 ), pluginDescriptor );
>                }
>            }
>            catch ( Exception e )
>            {
>                // TODO: don't catch exception
>                throw new ExpressionEvaluationException( "Error
> evaluating plugin parameter expression: " + expression,
>                                                         e );
>            }
>        }
> ...
>
> If I didn't miss anything this code make the value of any parameter
> expression starting with "plugin" to be null for sure, which will cause
> PluginParameterException in
> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809).
> Same thing happens to "settings" and "project".
>
> Is this a bug of maven-2.0.4? Is there any way to get pluginDescriptor
> in Mojo?
>
>
>
> Regards
>
> --
>
>
> Jiaqi Guo
>
> http://www.cyclopsgroup.org
> jiaqi.guo@gmail.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Can anyone explain this code

Posted by Wayne Fay <wa...@gmail.com>.
Thanks for your contribution, Jiaqi!

Wayne

On 2/13/07, Jiaqi Guo <cy...@gmail.com> wrote:
> Thanks Wayne,
>
> Although I found workaround for the tool that I'm working on, the patch
> for PluginParameterExpression could be really simple:
>
> sh-3.1$ svn diff
> Index:
> maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
> ===================================================================
> ---
> maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
> (revision 507376)
> +++
> maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
> (working copy)
> @@ -193,6 +193,10 @@
>         {
>             value = project.getExecutionProject();
>         }
> +        else if ( "plugin".equals( expression ) )
> +        {
> +            value = mojoDescriptor.getPluginDescriptor();
> +        }
>         else if ( expression.startsWith( "project" ) )
>         {
>             try
>
> So I'll go ahead and create Jira issue with patch.
>
> Maven is always one of my favorite open source projects since it was
> under Turbine. I'm very pleased to continue to make contribution.
>
>
> Regards
> -Jiaqi
>
>
>
> Wayne Fay wrote:
> > Without getting too far into the code myself, you seem to make some
> > very good arguments about possible problems in this code. ;-)
> >
> > I have no idea if this PluginParameterExpressionEvaluator class (and
> > the referenced code in Plexus) have proper unit tests etc, but it
> > seems like you could make a great contribution in this area if you
> > were interested.
> >
> > Thanks for the comments -- keep it up!
> >
> > Wayne
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Can anyone explain this code

Posted by Jiaqi Guo <cy...@gmail.com>.
Thanks Wayne,

Although I found workaround for the tool that I'm working on, the patch 
for PluginParameterExpression could be really simple:

sh-3.1$ svn diff
Index: 
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
===================================================================
--- 
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java    
(revision 507376)
+++ 
maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java    
(working copy)
@@ -193,6 +193,10 @@
         {
             value = project.getExecutionProject();
         }
+        else if ( "plugin".equals( expression ) )
+        {
+            value = mojoDescriptor.getPluginDescriptor();
+        }
         else if ( expression.startsWith( "project" ) )
         {
             try

So I'll go ahead and create Jira issue with patch.

Maven is always one of my favorite open source projects since it was 
under Turbine. I'm very pleased to continue to make contribution.


Regards
-Jiaqi



Wayne Fay wrote:
> Without getting too far into the code myself, you seem to make some
> very good arguments about possible problems in this code. ;-)
>
> I have no idea if this PluginParameterExpressionEvaluator class (and
> the referenced code in Plexus) have proper unit tests etc, but it
> seems like you could make a great contribution in this area if you
> were interested.
>
> Thanks for the comments -- keep it up!
>
> Wayne
>
> On 2/13/07, Jiaqi Guo <cy...@gmail.com> wrote:
>> Hi Franz,
>>
>> I tried to get PluginDescriptor within a mojo and got
>> PluginParameterException, then I started looking at this code.
>>
>> Assume expression is string "plugin", pathSeparator is -1, the
>> expression.substring(1) becomes "lugin". Did I miss anything here?
>>
>> And then looking at ReflectionValueExtractor.java today, I just realized
>> ReflectionValueExtractor.evaluate("lugin", pluginDescriptor) may work
>> since the first argument is irrelevant if string doesn't contain '.'.
>> But I'm more confused by the substring part of what .indexOf("/") is 
>> for.
>>
>> And still, in my Mojo, the parameter with expression "${plugin}" is
>> causing PluginParameterException which indicates the value of it is 
>> null.
>>
>> Regards
>> -Jiaqi
>>
>> franz see wrote:
>> > Good day to you, Jiaqi,
>> >
>> > Why do you say that it will be evaluted to null?
>> >
>> > Cheers,
>> > Franz
>> >
>> >
>> > Jiaqi Guo wrote:
>> >
>> >> Hi there,
>> >>
>> >> I'm trying to find out the build-in variables for a maven2 plugin and
>> >> found the following code in
>> >> 
>> 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 217:
>> >>
>> >> ...
>> >>         else if ( expression.startsWith( "plugin" ) )
>> >>         {
>> >>             try
>> >>             {
>> >>                 int pathSeparator = expression.indexOf( "/" );
>> >>
>> >>                 PluginDescriptor pluginDescriptor =
>> >> mojoDescriptor.getPluginDescriptor();
>> >>
>> >>                 if ( pathSeparator > 0 )
>> >>                 {
>> >>                     String pathExpression = expression.substring( 1,
>> >> pathSeparator );
>> >>                     value = ReflectionValueExtractor.evaluate(
>> >> pathExpression, pluginDescriptor );
>> >>                     value = value + expression.substring( 
>> pathSeparator );
>> >>                 }
>> >>                 else
>> >>                 {
>> >>                     value = ReflectionValueExtractor.evaluate(
>> >> expression.substring( 1 ), pluginDescriptor );
>> >>                 }
>> >>             }
>> >>             catch ( Exception e )
>> >>             {
>> >>                 // TODO: don't catch exception
>> >>                 throw new ExpressionEvaluationException( "Error
>> >> evaluating plugin parameter expression: " + expression,
>> >>                                                          e );
>> >>             }
>> >>         }
>> >> ...
>> >>
>> >> If I didn't miss anything this code make the value of any parameter
>> >> expression starting with "plugin" to be null for sure, which will 
>> cause
>> >> PluginParameterException in
>> >> 
>> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809). 
>>
>> >> Same thing happens to "settings" and "project".
>> >>
>> >> Is this a bug of maven-2.0.4? Is there any way to get 
>> pluginDescriptor
>> >> in Mojo?
>> >>
>> >>
>> >>
>> >> Regards
>> >>
>> >> --
>> >>
>> >>
>> >> Jiaqi Guo
>> >>
>> >> http://www.cyclopsgroup.org
>> >> jiaqi.guo@gmail.com
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> >> For additional commands, e-mail: users-help@maven.apache.org
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>> -- 
>>
>>
>> Jiaqi Guo
>>
>> http://www.cyclopsgroup.org
>> jiaqi.guo@gmail.com
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 


Jiaqi Guo

http://www.cyclopsgroup.org
jiaqi.guo@gmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Can anyone explain this code

Posted by Wayne Fay <wa...@gmail.com>.
Without getting too far into the code myself, you seem to make some
very good arguments about possible problems in this code. ;-)

I have no idea if this PluginParameterExpressionEvaluator class (and
the referenced code in Plexus) have proper unit tests etc, but it
seems like you could make a great contribution in this area if you
were interested.

Thanks for the comments -- keep it up!

Wayne

On 2/13/07, Jiaqi Guo <cy...@gmail.com> wrote:
> Hi Franz,
>
> I tried to get PluginDescriptor within a mojo and got
> PluginParameterException, then I started looking at this code.
>
> Assume expression is string "plugin", pathSeparator is -1, the
> expression.substring(1) becomes "lugin". Did I miss anything here?
>
> And then looking at ReflectionValueExtractor.java today, I just realized
> ReflectionValueExtractor.evaluate("lugin", pluginDescriptor) may work
> since the first argument is irrelevant if string doesn't contain '.'.
> But I'm more confused by the substring part of what .indexOf("/") is for.
>
> And still, in my Mojo, the parameter with expression "${plugin}" is
> causing PluginParameterException which indicates the value of it is null.
>
> Regards
> -Jiaqi
>
> franz see wrote:
> > Good day to you, Jiaqi,
> >
> > Why do you say that it will be evaluted to null?
> >
> > Cheers,
> > Franz
> >
> >
> > Jiaqi Guo wrote:
> >
> >> Hi there,
> >>
> >> I'm trying to find out the build-in variables for a maven2 plugin and
> >> found the following code in
> >> 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 217:
> >>
> >> ...
> >>         else if ( expression.startsWith( "plugin" ) )
> >>         {
> >>             try
> >>             {
> >>                 int pathSeparator = expression.indexOf( "/" );
> >>
> >>                 PluginDescriptor pluginDescriptor =
> >> mojoDescriptor.getPluginDescriptor();
> >>
> >>                 if ( pathSeparator > 0 )
> >>                 {
> >>                     String pathExpression = expression.substring( 1,
> >> pathSeparator );
> >>                     value = ReflectionValueExtractor.evaluate(
> >> pathExpression, pluginDescriptor );
> >>                     value = value + expression.substring( pathSeparator );
> >>                 }
> >>                 else
> >>                 {
> >>                     value = ReflectionValueExtractor.evaluate(
> >> expression.substring( 1 ), pluginDescriptor );
> >>                 }
> >>             }
> >>             catch ( Exception e )
> >>             {
> >>                 // TODO: don't catch exception
> >>                 throw new ExpressionEvaluationException( "Error
> >> evaluating plugin parameter expression: " + expression,
> >>                                                          e );
> >>             }
> >>         }
> >> ...
> >>
> >> If I didn't miss anything this code make the value of any parameter
> >> expression starting with "plugin" to be null for sure, which will cause
> >> PluginParameterException in
> >> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809).
> >> Same thing happens to "settings" and "project".
> >>
> >> Is this a bug of maven-2.0.4? Is there any way to get pluginDescriptor
> >> in Mojo?
> >>
> >>
> >>
> >> Regards
> >>
> >> --
> >>
> >>
> >> Jiaqi Guo
> >>
> >> http://www.cyclopsgroup.org
> >> jiaqi.guo@gmail.com
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >>
> >>
> >
> >
>
>
> --
>
>
> Jiaqi Guo
>
> http://www.cyclopsgroup.org
> jiaqi.guo@gmail.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Can anyone explain this code

Posted by franz see <fr...@gmail.com>.
Good day to you, Jiaqi,

Feel free to file a jira issue :-)

Cheers,
Franz


Jiaqi Guo wrote:
> 
> Hi Franz,
> 
> I seemed to miss this mail until just now. Sorry for late response.
> 
> I was trying to get some information of the plugin itself (A 
> PluginDescriptor object). In Maven1 this is feasible if Jelly script 
> refers something like "${plugin.get...}" so I guessed there should be 
> similar thing in Maven2. More specifically, I tried to find the full 
> path of a jar file which is one of plugin's dependencies. The workaround 
> ends up to be declaring a Map parameter with expression 
> "${plugin.artifactMap}"
> 
> Thanks for the link. It's strange that "${plugin}" is not mentioned 
> there. Maybe nobody needs it anymore, while the code that handles 
> "plugin" does exist since the very beginning of maven2.
> 
> 
> Best regards
> -Jiaqi
> 
> 
> franz see wrote:
> 
>>Good day to you, Jiaqi,
>>
>>Ah..yes. I also don't understand the purpose of that indexOf("/"). The
only
>>use case I can think of for that is that when the "/" is inside the curly
>>braces....which I don't think is recommendable anyway. 
>>
>>But like what you said, the first argument of ${x.y.z} is irrelevant for
the
>>expression evaluator. Thus, it will still not return null.
>>
>>Btw, what are you trying to retrieve with ${plugin} -
>>org.apache.maven.model.Plugin? If so, on top of my head, I suggest getting
>>all the build plugins and searching for the build plugin which matches
>>${plugin.groupId} ${plugin.artifactId}, and ${plugin.version}. ...But I am
>>not sure though why would you want the model of the Plugin.
>>
>>Btw, for more information about the Maven Properties, kindly check [1].
>>
>>Cheers,
>>Franz
>>
>>[1] http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
>>
>>
>>Jiaqi Guo wrote:
>>  
>>
>>>Hi Franz,
>>>
>>>I tried to get PluginDescriptor within a mojo and got 
>>>PluginParameterException, then I started looking at this code.
>>>
>>>Assume expression is string "plugin", pathSeparator is -1, the 
>>>expression.substring(1) becomes "lugin". Did I miss anything here?
>>>
>>>And then looking at ReflectionValueExtractor.java today, I just realized 
>>>ReflectionValueExtractor.evaluate("lugin", pluginDescriptor) may work 
>>>since the first argument is irrelevant if string doesn't contain '.'.  
>>>But I'm more confused by the substring part of what .indexOf("/") is for.
>>>
>>>And still, in my Mojo, the parameter with expression "${plugin}" is 
>>>causing PluginParameterException which indicates the value of it is null.
>>>
>>>Regards
>>>-Jiaqi
>>>
>>>franz see wrote:
>>>    
>>>
>>>>Good day to you, Jiaqi,
>>>>
>>>>Why do you say that it will be evaluted to null?
>>>>
>>>>Cheers,
>>>>Franz
>>>>
>>>>
>>>>Jiaqi Guo wrote:
>>>>  
>>>>      
>>>>
>>>>>Hi there,
>>>>>
>>>>>I'm trying to find out the build-in variables for a maven2 plugin and 
>>>>>found the following code in 
>>>>>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 217:
>>>>>
>>>>>...
>>>>>        else if ( expression.startsWith( "plugin" ) )
>>>>>        {
>>>>>            try
>>>>>            {
>>>>>                int pathSeparator = expression.indexOf( "/" );
>>>>>
>>>>>                PluginDescriptor pluginDescriptor = 
>>>>>mojoDescriptor.getPluginDescriptor();
>>>>>
>>>>>                if ( pathSeparator > 0 )
>>>>>                {
>>>>>                    String pathExpression = expression.substring( 1, 
>>>>>pathSeparator );
>>>>>                    value = ReflectionValueExtractor.evaluate( 
>>>>>pathExpression, pluginDescriptor );
>>>>>                    value = value + expression.substring( pathSeparator
>>>>>);
>>>>>                }
>>>>>                else
>>>>>                {
>>>>>                    value = ReflectionValueExtractor.evaluate( 
>>>>>expression.substring( 1 ), pluginDescriptor );
>>>>>                }
>>>>>            }
>>>>>            catch ( Exception e )
>>>>>            {
>>>>>                // TODO: don't catch exception
>>>>>                throw new ExpressionEvaluationException( "Error 
>>>>>evaluating plugin parameter expression: " + expression,
>>>>>                                                         e );
>>>>>            }
>>>>>        }
>>>>>...
>>>>>
>>>>>If I didn't miss anything this code make the value of any parameter 
>>>>>expression starting with "plugin" to be null for sure, which will cause 
>>>>>PluginParameterException in 
>>>>>org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809). 
>>>>>Same thing happens to "settings" and "project".
>>>>>
>>>>>Is this a bug of maven-2.0.4? Is there any way to get pluginDescriptor 
>>>>>in Mojo?
>>>>>
>>>>>
>>>>>
>>>>>Regards
>>>>>
>>>>>-- 
>>>>>
>>>>>
>>>>>Jiaqi Guo
>>>>>
>>>>>http://www.cyclopsgroup.org
>>>>>jiaqi.guo@gmail.com
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>>
>>>>>
>>>>>
>>>>>    
>>>>>        
>>>>>
>>>>  
>>>>      
>>>>
>>>-- 
>>>
>>>
>>>Jiaqi Guo
>>>
>>>http://www.cyclopsgroup.org
>>>jiaqi.guo@gmail.com
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>    
>>>
>>
>>  
>>
> 
> 
> -- 
> 
> 
> 
> Jiaqi Guo
> 
> http://www.cyclopsgroup.org
> jiaqi.guo@gmail.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-anyone-explain-this-code-tf3218981s177.html#a9051587
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Can anyone explain this code

Posted by Jiaqi Guo <cy...@gmail.com>.
Hi Franz,

I seemed to miss this mail until just now. Sorry for late response.

I was trying to get some information of the plugin itself (A 
PluginDescriptor object). In Maven1 this is feasible if Jelly script 
refers something like "${plugin.get...}" so I guessed there should be 
similar thing in Maven2. More specifically, I tried to find the full 
path of a jar file which is one of plugin's dependencies. The workaround 
ends up to be declaring a Map parameter with expression 
"${plugin.artifactMap}"

Thanks for the link. It's strange that "${plugin}" is not mentioned 
there. Maybe nobody needs it anymore, while the code that handles 
"plugin" does exist since the very beginning of maven2.


Best regards
-Jiaqi


franz see wrote:

>Good day to you, Jiaqi,
>
>Ah..yes. I also don't understand the purpose of that indexOf("/"). The only
>use case I can think of for that is that when the "/" is inside the curly
>braces....which I don't think is recommendable anyway. 
>
>But like what you said, the first argument of ${x.y.z} is irrelevant for the
>expression evaluator. Thus, it will still not return null.
>
>Btw, what are you trying to retrieve with ${plugin} -
>org.apache.maven.model.Plugin? If so, on top of my head, I suggest getting
>all the build plugins and searching for the build plugin which matches
>${plugin.groupId} ${plugin.artifactId}, and ${plugin.version}. ...But I am
>not sure though why would you want the model of the Plugin.
>
>Btw, for more information about the Maven Properties, kindly check [1].
>
>Cheers,
>Franz
>
>[1] http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
>
>
>Jiaqi Guo wrote:
>  
>
>>Hi Franz,
>>
>>I tried to get PluginDescriptor within a mojo and got 
>>PluginParameterException, then I started looking at this code.
>>
>>Assume expression is string "plugin", pathSeparator is -1, the 
>>expression.substring(1) becomes "lugin". Did I miss anything here?
>>
>>And then looking at ReflectionValueExtractor.java today, I just realized 
>>ReflectionValueExtractor.evaluate("lugin", pluginDescriptor) may work 
>>since the first argument is irrelevant if string doesn't contain '.'.  
>>But I'm more confused by the substring part of what .indexOf("/") is for.
>>
>>And still, in my Mojo, the parameter with expression "${plugin}" is 
>>causing PluginParameterException which indicates the value of it is null.
>>
>>Regards
>>-Jiaqi
>>
>>franz see wrote:
>>    
>>
>>>Good day to you, Jiaqi,
>>>
>>>Why do you say that it will be evaluted to null?
>>>
>>>Cheers,
>>>Franz
>>>
>>>
>>>Jiaqi Guo wrote:
>>>  
>>>      
>>>
>>>>Hi there,
>>>>
>>>>I'm trying to find out the build-in variables for a maven2 plugin and 
>>>>found the following code in 
>>>>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 217:
>>>>
>>>>...
>>>>        else if ( expression.startsWith( "plugin" ) )
>>>>        {
>>>>            try
>>>>            {
>>>>                int pathSeparator = expression.indexOf( "/" );
>>>>
>>>>                PluginDescriptor pluginDescriptor = 
>>>>mojoDescriptor.getPluginDescriptor();
>>>>
>>>>                if ( pathSeparator > 0 )
>>>>                {
>>>>                    String pathExpression = expression.substring( 1, 
>>>>pathSeparator );
>>>>                    value = ReflectionValueExtractor.evaluate( 
>>>>pathExpression, pluginDescriptor );
>>>>                    value = value + expression.substring( pathSeparator
>>>>);
>>>>                }
>>>>                else
>>>>                {
>>>>                    value = ReflectionValueExtractor.evaluate( 
>>>>expression.substring( 1 ), pluginDescriptor );
>>>>                }
>>>>            }
>>>>            catch ( Exception e )
>>>>            {
>>>>                // TODO: don't catch exception
>>>>                throw new ExpressionEvaluationException( "Error 
>>>>evaluating plugin parameter expression: " + expression,
>>>>                                                         e );
>>>>            }
>>>>        }
>>>>...
>>>>
>>>>If I didn't miss anything this code make the value of any parameter 
>>>>expression starting with "plugin" to be null for sure, which will cause 
>>>>PluginParameterException in 
>>>>org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809). 
>>>>Same thing happens to "settings" and "project".
>>>>
>>>>Is this a bug of maven-2.0.4? Is there any way to get pluginDescriptor 
>>>>in Mojo?
>>>>
>>>>
>>>>
>>>>Regards
>>>>
>>>>-- 
>>>>
>>>>
>>>>Jiaqi Guo
>>>>
>>>>http://www.cyclopsgroup.org
>>>>jiaqi.guo@gmail.com
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>>For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>>    
>>>>        
>>>>
>>>  
>>>      
>>>
>>-- 
>>
>>
>>Jiaqi Guo
>>
>>http://www.cyclopsgroup.org
>>jiaqi.guo@gmail.com
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>    
>>
>
>  
>


-- 



Jiaqi Guo

http://www.cyclopsgroup.org
jiaqi.guo@gmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Can anyone explain this code

Posted by franz see <fr...@gmail.com>.
Good day to you, Jiaqi,

Ah..yes. I also don't understand the purpose of that indexOf("/"). The only
use case I can think of for that is that when the "/" is inside the curly
braces....which I don't think is recommendable anyway. 

But like what you said, the first argument of ${x.y.z} is irrelevant for the
expression evaluator. Thus, it will still not return null.

Btw, what are you trying to retrieve with ${plugin} -
org.apache.maven.model.Plugin? If so, on top of my head, I suggest getting
all the build plugins and searching for the build plugin which matches
${plugin.groupId} ${plugin.artifactId}, and ${plugin.version}. ...But I am
not sure though why would you want the model of the Plugin.

Btw, for more information about the Maven Properties, kindly check [1].

Cheers,
Franz

[1] http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide


Jiaqi Guo wrote:
> 
> Hi Franz,
> 
> I tried to get PluginDescriptor within a mojo and got 
> PluginParameterException, then I started looking at this code.
> 
> Assume expression is string "plugin", pathSeparator is -1, the 
> expression.substring(1) becomes "lugin". Did I miss anything here?
> 
> And then looking at ReflectionValueExtractor.java today, I just realized 
> ReflectionValueExtractor.evaluate("lugin", pluginDescriptor) may work 
> since the first argument is irrelevant if string doesn't contain '.'.  
> But I'm more confused by the substring part of what .indexOf("/") is for.
> 
> And still, in my Mojo, the parameter with expression "${plugin}" is 
> causing PluginParameterException which indicates the value of it is null.
> 
> Regards
> -Jiaqi
> 
> franz see wrote:
>> Good day to you, Jiaqi,
>>
>> Why do you say that it will be evaluted to null?
>>
>> Cheers,
>> Franz
>>
>>
>> Jiaqi Guo wrote:
>>   
>>> Hi there,
>>>
>>> I'm trying to find out the build-in variables for a maven2 plugin and 
>>> found the following code in 
>>> 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 217:
>>>
>>> ...
>>>         else if ( expression.startsWith( "plugin" ) )
>>>         {
>>>             try
>>>             {
>>>                 int pathSeparator = expression.indexOf( "/" );
>>>
>>>                 PluginDescriptor pluginDescriptor = 
>>> mojoDescriptor.getPluginDescriptor();
>>>
>>>                 if ( pathSeparator > 0 )
>>>                 {
>>>                     String pathExpression = expression.substring( 1, 
>>> pathSeparator );
>>>                     value = ReflectionValueExtractor.evaluate( 
>>> pathExpression, pluginDescriptor );
>>>                     value = value + expression.substring( pathSeparator
>>> );
>>>                 }
>>>                 else
>>>                 {
>>>                     value = ReflectionValueExtractor.evaluate( 
>>> expression.substring( 1 ), pluginDescriptor );
>>>                 }
>>>             }
>>>             catch ( Exception e )
>>>             {
>>>                 // TODO: don't catch exception
>>>                 throw new ExpressionEvaluationException( "Error 
>>> evaluating plugin parameter expression: " + expression,
>>>                                                          e );
>>>             }
>>>         }
>>> ...
>>>
>>> If I didn't miss anything this code make the value of any parameter 
>>> expression starting with "plugin" to be null for sure, which will cause 
>>> PluginParameterException in 
>>> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809). 
>>> Same thing happens to "settings" and "project".
>>>
>>> Is this a bug of maven-2.0.4? Is there any way to get pluginDescriptor 
>>> in Mojo?
>>>
>>>
>>>
>>> Regards
>>>
>>> -- 
>>>
>>>
>>> Jiaqi Guo
>>>
>>> http://www.cyclopsgroup.org
>>> jiaqi.guo@gmail.com
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> -- 
> 
> 
> Jiaqi Guo
> 
> http://www.cyclopsgroup.org
> jiaqi.guo@gmail.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-anyone-explain-this-code-tf3218981s177.html#a8962743
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Can anyone explain this code

Posted by franz see <fr...@gmail.com>.
Good day to you, Jiaqi,

Actually, the second if statement handles that ( the one after "String
expression = stripTokens( expr );" ). It takes in the contents of "${" and
"}" and recursively evaluates it. If the expr passed to evaluate(...) is not
a ${...}, then the actual substitution takes place. 

The way I see it, indexOf("/") is used to evalute "/" which are inside
${...}. Why would you want to do that? - I don't know :-)

Cheers,
Franz


Jiaqi Guo wrote:
> 
> In fact, the ReflectionValueExtractor.evaluate("lugin", 
> pluginDescriptor) does return null. The first token in while loop is 
> "lugin", which calls "getLugin()" of root object and returns null. I 
> guess this is where the problem is. Maybe there should be another 'else 
> if ( "plugin".equals( expression ) )' before 'else if ( 
> expression.startsWith( "plugin" ) )' .
> 
> And I think I begin to understand the indexOf( "/" ) now. Is it to allow 
> user to specify things like 
> "${project.build.sourceDirectory}/some/sub/directory"?
> 
> Thanks
> -Jiaqi
> 
> Jiaqi Guo wrote:
>> Hi Franz,
>>
>> I tried to get PluginDescriptor within a mojo and got 
>> PluginParameterException, then I started looking at this code.
>>
>> Assume expression is string "plugin", pathSeparator is -1, the 
>> expression.substring(1) becomes "lugin". Did I miss anything here?
>>
>> And then looking at ReflectionValueExtractor.java today, I just 
>> realized ReflectionValueExtractor.evaluate("lugin", pluginDescriptor) 
>> may work since the first argument is irrelevant if string doesn't 
>> contain '.'.  But I'm more confused by the substring part of what 
>> .indexOf("/") is for.
>>
>> And still, in my Mojo, the parameter with expression "${plugin}" is 
>> causing PluginParameterException which indicates the value of it is null.
>>
>> Regards
>> -Jiaqi
>>
>> franz see wrote:
>>> Good day to you, Jiaqi,
>>>
>>> Why do you say that it will be evaluted to null?
>>>
>>> Cheers,
>>> Franz
>>>
>>>
>>> Jiaqi Guo wrote:
>>>  
>>>> Hi there,
>>>>
>>>> I'm trying to find out the build-in variables for a maven2 plugin 
>>>> and found the following code in 
>>>> 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 217:
>>>>
>>>> ...
>>>>         else if ( expression.startsWith( "plugin" ) )
>>>>         {
>>>>             try
>>>>             {
>>>>                 int pathSeparator = expression.indexOf( "/" );
>>>>
>>>>                 PluginDescriptor pluginDescriptor = 
>>>> mojoDescriptor.getPluginDescriptor();
>>>>
>>>>                 if ( pathSeparator > 0 )
>>>>                 {
>>>>                     String pathExpression = expression.substring( 1, 
>>>> pathSeparator );
>>>>                     value = ReflectionValueExtractor.evaluate( 
>>>> pathExpression, pluginDescriptor );
>>>>                     value = value + expression.substring( 
>>>> pathSeparator );
>>>>                 }
>>>>                 else
>>>>                 {
>>>>                     value = ReflectionValueExtractor.evaluate( 
>>>> expression.substring( 1 ), pluginDescriptor );
>>>>                 }
>>>>             }
>>>>             catch ( Exception e )
>>>>             {
>>>>                 // TODO: don't catch exception
>>>>                 throw new ExpressionEvaluationException( "Error 
>>>> evaluating plugin parameter expression: " + expression,
>>>>                                                          e );
>>>>             }
>>>>         }
>>>> ...
>>>>
>>>> If I didn't miss anything this code make the value of any parameter 
>>>> expression starting with "plugin" to be null for sure, which will 
>>>> cause PluginParameterException in 
>>>> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809). 
>>>> Same thing happens to "settings" and "project".
>>>>
>>>> Is this a bug of maven-2.0.4? Is there any way to get 
>>>> pluginDescriptor in Mojo?
>>>>
>>>>
>>>>
>>>> Regards
>>>>
>>>> -- 
>>>>
>>>>
>>>> Jiaqi Guo
>>>>
>>>> http://www.cyclopsgroup.org
>>>> jiaqi.guo@gmail.com
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>>
>>>>     
>>>
>>>   
>>
>>
> 
> 
> -- 
> 
> 
> Jiaqi Guo
> 
> http://www.cyclopsgroup.org
> jiaqi.guo@gmail.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-anyone-explain-this-code-tf3218981s177.html#a9053579
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Can anyone explain this code

Posted by Jiaqi Guo <cy...@gmail.com>.
In fact, the ReflectionValueExtractor.evaluate("lugin", 
pluginDescriptor) does return null. The first token in while loop is 
"lugin", which calls "getLugin()" of root object and returns null. I 
guess this is where the problem is. Maybe there should be another 'else 
if ( "plugin".equals( expression ) )' before 'else if ( 
expression.startsWith( "plugin" ) )' .

And I think I begin to understand the indexOf( "/" ) now. Is it to allow 
user to specify things like 
"${project.build.sourceDirectory}/some/sub/directory"?

Thanks
-Jiaqi

Jiaqi Guo wrote:
> Hi Franz,
>
> I tried to get PluginDescriptor within a mojo and got 
> PluginParameterException, then I started looking at this code.
>
> Assume expression is string "plugin", pathSeparator is -1, the 
> expression.substring(1) becomes "lugin". Did I miss anything here?
>
> And then looking at ReflectionValueExtractor.java today, I just 
> realized ReflectionValueExtractor.evaluate("lugin", pluginDescriptor) 
> may work since the first argument is irrelevant if string doesn't 
> contain '.'.  But I'm more confused by the substring part of what 
> .indexOf("/") is for.
>
> And still, in my Mojo, the parameter with expression "${plugin}" is 
> causing PluginParameterException which indicates the value of it is null.
>
> Regards
> -Jiaqi
>
> franz see wrote:
>> Good day to you, Jiaqi,
>>
>> Why do you say that it will be evaluted to null?
>>
>> Cheers,
>> Franz
>>
>>
>> Jiaqi Guo wrote:
>>  
>>> Hi there,
>>>
>>> I'm trying to find out the build-in variables for a maven2 plugin 
>>> and found the following code in 
>>> 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 217:
>>>
>>> ...
>>>         else if ( expression.startsWith( "plugin" ) )
>>>         {
>>>             try
>>>             {
>>>                 int pathSeparator = expression.indexOf( "/" );
>>>
>>>                 PluginDescriptor pluginDescriptor = 
>>> mojoDescriptor.getPluginDescriptor();
>>>
>>>                 if ( pathSeparator > 0 )
>>>                 {
>>>                     String pathExpression = expression.substring( 1, 
>>> pathSeparator );
>>>                     value = ReflectionValueExtractor.evaluate( 
>>> pathExpression, pluginDescriptor );
>>>                     value = value + expression.substring( 
>>> pathSeparator );
>>>                 }
>>>                 else
>>>                 {
>>>                     value = ReflectionValueExtractor.evaluate( 
>>> expression.substring( 1 ), pluginDescriptor );
>>>                 }
>>>             }
>>>             catch ( Exception e )
>>>             {
>>>                 // TODO: don't catch exception
>>>                 throw new ExpressionEvaluationException( "Error 
>>> evaluating plugin parameter expression: " + expression,
>>>                                                          e );
>>>             }
>>>         }
>>> ...
>>>
>>> If I didn't miss anything this code make the value of any parameter 
>>> expression starting with "plugin" to be null for sure, which will 
>>> cause PluginParameterException in 
>>> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809). 
>>> Same thing happens to "settings" and "project".
>>>
>>> Is this a bug of maven-2.0.4? Is there any way to get 
>>> pluginDescriptor in Mojo?
>>>
>>>
>>>
>>> Regards
>>>
>>> -- 
>>>
>>>
>>> Jiaqi Guo
>>>
>>> http://www.cyclopsgroup.org
>>> jiaqi.guo@gmail.com
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>     
>>
>>   
>
>


-- 


Jiaqi Guo

http://www.cyclopsgroup.org
jiaqi.guo@gmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Can anyone explain this code

Posted by Jiaqi Guo <cy...@gmail.com>.
Hi Franz,

I tried to get PluginDescriptor within a mojo and got 
PluginParameterException, then I started looking at this code.

Assume expression is string "plugin", pathSeparator is -1, the 
expression.substring(1) becomes "lugin". Did I miss anything here?

And then looking at ReflectionValueExtractor.java today, I just realized 
ReflectionValueExtractor.evaluate("lugin", pluginDescriptor) may work 
since the first argument is irrelevant if string doesn't contain '.'.  
But I'm more confused by the substring part of what .indexOf("/") is for.

And still, in my Mojo, the parameter with expression "${plugin}" is 
causing PluginParameterException which indicates the value of it is null.

Regards
-Jiaqi

franz see wrote:
> Good day to you, Jiaqi,
>
> Why do you say that it will be evaluted to null?
>
> Cheers,
> Franz
>
>
> Jiaqi Guo wrote:
>   
>> Hi there,
>>
>> I'm trying to find out the build-in variables for a maven2 plugin and 
>> found the following code in 
>> 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 217:
>>
>> ...
>>         else if ( expression.startsWith( "plugin" ) )
>>         {
>>             try
>>             {
>>                 int pathSeparator = expression.indexOf( "/" );
>>
>>                 PluginDescriptor pluginDescriptor = 
>> mojoDescriptor.getPluginDescriptor();
>>
>>                 if ( pathSeparator > 0 )
>>                 {
>>                     String pathExpression = expression.substring( 1, 
>> pathSeparator );
>>                     value = ReflectionValueExtractor.evaluate( 
>> pathExpression, pluginDescriptor );
>>                     value = value + expression.substring( pathSeparator );
>>                 }
>>                 else
>>                 {
>>                     value = ReflectionValueExtractor.evaluate( 
>> expression.substring( 1 ), pluginDescriptor );
>>                 }
>>             }
>>             catch ( Exception e )
>>             {
>>                 // TODO: don't catch exception
>>                 throw new ExpressionEvaluationException( "Error 
>> evaluating plugin parameter expression: " + expression,
>>                                                          e );
>>             }
>>         }
>> ...
>>
>> If I didn't miss anything this code make the value of any parameter 
>> expression starting with "plugin" to be null for sure, which will cause 
>> PluginParameterException in 
>> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809). 
>> Same thing happens to "settings" and "project".
>>
>> Is this a bug of maven-2.0.4? Is there any way to get pluginDescriptor 
>> in Mojo?
>>
>>
>>
>> Regards
>>
>> -- 
>>
>>
>> Jiaqi Guo
>>
>> http://www.cyclopsgroup.org
>> jiaqi.guo@gmail.com
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>     
>
>   


-- 


Jiaqi Guo

http://www.cyclopsgroup.org
jiaqi.guo@gmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Can anyone explain this code

Posted by franz see <fr...@gmail.com>.
Good day to you, Jiaqi,

Why do you say that it will be evaluted to null?

Cheers,
Franz


Jiaqi Guo wrote:
> 
> Hi there,
> 
> I'm trying to find out the build-in variables for a maven2 plugin and 
> found the following code in 
> 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 217:
> 
> ...
>         else if ( expression.startsWith( "plugin" ) )
>         {
>             try
>             {
>                 int pathSeparator = expression.indexOf( "/" );
> 
>                 PluginDescriptor pluginDescriptor = 
> mojoDescriptor.getPluginDescriptor();
> 
>                 if ( pathSeparator > 0 )
>                 {
>                     String pathExpression = expression.substring( 1, 
> pathSeparator );
>                     value = ReflectionValueExtractor.evaluate( 
> pathExpression, pluginDescriptor );
>                     value = value + expression.substring( pathSeparator );
>                 }
>                 else
>                 {
>                     value = ReflectionValueExtractor.evaluate( 
> expression.substring( 1 ), pluginDescriptor );
>                 }
>             }
>             catch ( Exception e )
>             {
>                 // TODO: don't catch exception
>                 throw new ExpressionEvaluationException( "Error 
> evaluating plugin parameter expression: " + expression,
>                                                          e );
>             }
>         }
> ...
> 
> If I didn't miss anything this code make the value of any parameter 
> expression starting with "plugin" to be null for sure, which will cause 
> PluginParameterException in 
> org.apache.maven.plugin.DefaultPluginManager.checkRequiredParameters(DefaultPluginManager.java:809). 
> Same thing happens to "settings" and "project".
> 
> Is this a bug of maven-2.0.4? Is there any way to get pluginDescriptor 
> in Mojo?
> 
> 
> 
> Regards
> 
> -- 
> 
> 
> Jiaqi Guo
> 
> http://www.cyclopsgroup.org
> jiaqi.guo@gmail.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can-anyone-explain-this-code-tf3218981s177.html#a8942925
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org