You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by ev...@apache.org on 2004/09/11 14:16:19 UTC

cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/plugin OgnlProjectValueExtractor.java

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();
  
  
  

Re: ognl WAS: cvs commit:maven-components/maven-core/src/main/java/org/apache/maven/pluginOgnlProjectValueExtractor.java

Posted by Emmanuel Venisse <em...@venisse.net>.
----- Original Message ----- 
From: "Jason van Zyl" <jv...@maven.org>
To: "Maven 2 Developers List" <m2...@maven.apache.org>
Sent: Sunday, September 12, 2004 5:50 PM
Subject: Re: ognl WAS: cvs
commit:maven-components/maven-core/src/main/java/org/apache/maven/pluginOgnl
ProjectValueExtractor.java


> On Sun, 2004-09-12 at 07:42, Emmanuel Venisse wrote:
>
> > I make this little change for run the doxia plugin, but I don't like
> > basedir/* property.
> > For the doxia plugin, I think we should add a siteDirectory in the build
pom
> > part and remove my changes.
>
> Some form of site element in the POM is a great idea. I don't think it
> belongs in the build section though.
>
> I am deploying the site using elements in <distributionManagement/> but
> we could probably do with a <siteManagement/> element to encapsulate all
> things related to the site.

+1

>
> I honestly thing #basedir could eventually go away entirely, we should
> have standard places for everything. What maven produces and uses is
> boundless but we certainly can have standard top-level directories for
> anything produced. Using #basedir is admittedly a bad idea.
>
> > >
> > > 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?
> >
> > Sure, do you want to fix it?
>
> Let's get rid of the use of #basedir, when we then encounter a
> short-coming we can adjust for it instead of adding more hacks.
>
> -- 
> jvz.
>
> Jason van Zyl
> jason@maven.org
> http://maven.apache.org
>
> happiness is like a butterfly: the more you chase it, the more it will
> elude you, but if you turn your attention to other things, it will come
> and sit softly on your shoulder ...
>
>  -- Thoreau
>
>


Re: ognl WAS: cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/plugin OgnlProjectValueExtractor.java

Posted by Jason van Zyl <jv...@maven.org>.
On Sun, 2004-09-12 at 07:42, Emmanuel Venisse wrote:

> I make this little change for run the doxia plugin, but I don't like
> basedir/* property.
> For the doxia plugin, I think we should add a siteDirectory in the build pom
> part and remove my changes.

Some form of site element in the POM is a great idea. I don't think it
belongs in the build section though.

I am deploying the site using elements in <distributionManagement/> but
we could probably do with a <siteManagement/> element to encapsulate all
things related to the site.

I honestly thing #basedir could eventually go away entirely, we should
have standard places for everything. What maven produces and uses is
boundless but we certainly can have standard top-level directories for
anything produced. Using #basedir is admittedly a bad idea.

> >
> > 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?
> 
> Sure, do you want to fix it?

Let's get rid of the use of #basedir, when we then encounter a
short-coming we can adjust for it instead of adding more hacks.

-- 
jvz.

Jason van Zyl
jason@maven.org
http://maven.apache.org

happiness is like a butterfly: the more you chase it, the more it will
elude you, but if you turn your attention to other things, it will come
and sit softly on your shoulder ...

 -- Thoreau 


Re: ognl WAS: cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/plugin OgnlProjectValueExtractor.java

Posted by Emmanuel Venisse <em...@venisse.net>.
----- Original Message ----- 
From: "Brett Porter" <br...@apache.org>
To: "Maven 2 Developers List" <m2...@maven.apache.org>
Sent: Sunday, September 12, 2004 1:13 AM
Subject: re: ognl WAS: cvs commit:
maven-components/maven-core/src/main/java/org/apache/maven/plugin
OgnlProjectValueExtractor.java


> 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.

I make this little change for run the doxia plugin, but I don't like
basedir/* property.
For the doxia plugin, I think we should add a siteDirectory in the build pom
part and remove my changes.

>
> 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?

Sure, do you want to fix it?

>
> 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/OgnlProjec
tValueExtractor.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();
> >
> >
> >
> >
>
>
>


re: ognl WAS: cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/plugin OgnlProjectValueExtractor.java

Posted by Brett Porter <br...@apache.org>.
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();
>   
>   
>   
>