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 <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to