jvanzyl     2004/02/16 12:38:45

  Modified:    maven-core bootstrap.plugins
               maven-core/src/java/org/apache/maven/plugin/plexus
                        PlexusPluginManager.java PluginConfigurator.java
  Log:
  o allow any ognl expression
  
  Revision  Changes    Path
  1.3       +1 -0      maven-components/maven-core/bootstrap.plugins
  
  Index: bootstrap.plugins
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/bootstrap.plugins,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- bootstrap.plugins 12 Feb 2004 01:59:00 -0000      1.2
  +++ bootstrap.plugins 16 Feb 2004 20:38:45 -0000      1.3
  @@ -1,3 +1,4 @@
   maven-compiler-plugin
   maven-jar-plugin
  +maven-resources-plugin
   maven-surefire-plugin
  
  
  
  1.11      +0 -0      
maven-components/maven-core/src/java/org/apache/maven/plugin/plexus/PlexusPluginManager.java
  
  Index: PlexusPluginManager.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/java/org/apache/maven/plugin/plexus/PlexusPluginManager.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  
  
  
  1.2       +19 -15    
maven-components/maven-core/src/java/org/apache/maven/plugin/plexus/PluginConfigurator.java
  
  Index: PluginConfigurator.java
  ===================================================================
  RCS file: 
/home/cvs/maven-components/maven-core/src/java/org/apache/maven/plugin/plexus/PluginConfigurator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PluginConfigurator.java   15 Feb 2004 21:43:19 -0000      1.1
  +++ PluginConfigurator.java   16 Feb 2004 20:38:45 -0000      1.2
  @@ -7,6 +7,8 @@
   import org.apache.maven.plugin.plexus.PluginConfigurationException;
   
   import java.lang.reflect.Field;
  +import java.util.Map;
  +import java.util.HashMap;
   
   /**
    *
  @@ -24,6 +26,10 @@
   
           int size = configuration.getChildCount();
   
  +        Map context = new HashMap();
  +
  +        context.put( "project", project );
  +
           for ( int i = 0; i < size; i++ )
           {
               Xpp3Dom c = configuration.getChild( i );
  @@ -34,26 +40,24 @@
   
               Object value;
   
  -            if ( expression.startsWith( "#" ) )
  +            try
               {
  -                try
  -                {
  -                    value = Ognl.getValue( expression.substring( 1 ), project );
  -                }
  -                catch ( OgnlException e )
  -                {
  -                    throw new PluginConfigurationException(
  -                        "Error trying to evaluate expression " + expression + " for 
the field " + fieldName, e );
  -                }
  +                value = Ognl.getValue( expression, context, (Object)null );
               }
  -            else if ( expression.equals( "project" ) )
  -            {
  -                value = project;
  -            }
  -            else
  +            catch ( OgnlException e )
               {
  +                // If Ognl evaluation fails we will try to get a property
  +
  +                if ( expression.startsWith( "#" ) )
  +                {
  +                    expression = expression.substring( 1 );
  +                }
  +
                   value = project.getProperty( expression );
               }
  +
  +            // If we strike out we'll just use the expression which allows
  +            // people to use hardcoded values if they wish.
   
               if ( value == null )
               {
  
  
  

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

Reply via email to