maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject re: ognl WAS: cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/plugin OgnlProjectValueExtractor.java
Date Sat, 11 Sep 2004 23:13:27 GMT
Emmanuel,

This would break something like:
#basedir2
where you define basedir2 yourself.

It also duplicates path handling code from #project and overlaps the definition
of just #basedir.

Perhaps we should change this whole handler such that we check # first to see if
it is an expression. If so we next split it on / if it exists and keep the path
element, then do the expression handling. We would also need to evaluate the
path as an expression in case there are subexpressions.

What do you think?

I'm not sure on the background, but is there intended to be a way that we can do
things that have more than the expression, but are not paths, eg:
#{theme}.html

where theme is the property?

Thanks,
Brett

Quoting evenisse@apache.org:

> evenisse    2004/09/11 05:16:19
> 
>   Modified:    maven-core/src/main/java/org/apache/maven/plugin
>                         OgnlProjectValueExtractor.java
>   Log:
>   Add basedir sub-directories
>   
>   Revision  Changes    Path
>   1.5       +23 -1    
>
maven-components/maven-core/src/main/java/org/apache/maven/plugin/OgnlProjectValueExtractor.java
>   
>   Index: OgnlProjectValueExtractor.java
>   ===================================================================
>   RCS file:
>
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/OgnlProjectValueExtractor.java,v
>   retrieving revision 1.4
>   retrieving revision 1.5
>   diff -u -r1.4 -r1.5
>   --- OgnlProjectValueExtractor.java	2 Sep 2004 12:34:17 -0000	1.4
>   +++ OgnlProjectValueExtractor.java	11 Sep 2004 12:16:19 -0000	1.5
>   @@ -88,6 +88,28 @@
>            {
>                value =
> context.getProject().getFile().getParentFile().getAbsolutePath();
>            }
>   +        else if ( expression.startsWith( "#basedir" ) )
>   +        {
>   +            try
>   +            {
>   +                int pathSeparator = expression.indexOf( "/" );
>   +
>   +                if ( pathSeparator > 0 )
>   +                {
>   +                    value =
> context.getProject().getFile().getParentFile().getAbsolutePath()
>   +                        + expression.substring( pathSeparator );
>   +                }
>   +                else
>   +                {
>   +                    new Exception( "Got expression '" + expression + "'
> that was not recognised" ).printStackTrace();
>   +                }
>   +            }
>   +            catch ( OgnlException e )
>   +            {
>   +                // do nothing
>   +                e.printStackTrace(); // TODO: should log? should ignore as
> previously?
>   +            }
>   +        }
>            else if ( expression.startsWith( "#" ) )
>            {
>                new Exception( "Got expression '" + expression + "' that was
> not recognised" ).printStackTrace();
>   
>   
>   
> 



Mime
View raw message