You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Claude Brisson <cl...@renegat.net> on 2008/06/02 16:28:00 UTC

Re: How to check Velocity version?

You would typically check for the presence of a class that has been
added since 1.5 - the typical getVersion() stuff hasn't been put yet in
Velocity.


  Claude

Le vendredi 23 mai 2008 à 14:07 +0100, sebb a écrit :
> How can one check the Velocity version from an Ant script?
> 
> I had a problem with Anakia generating the wrong line endings on
> Linux; turned out it was due to Ant picking up the wrong version of
> the Velocity jar.
> 
> It would be useful if one could check the version and report an error
> if the version is earlier than  1.5 (say).
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: How to check Velocity version?

Posted by sebb <se...@gmail.com>.
On 02/06/2008, Will Glass-Husain <wg...@gmail.com> wrote:
> Is there a way to check the manifest file?
>

Neat idea!

A manifest resource can be loaded using

<javaresource name="META-INF/MANIFEST.MF" classpath="${velocity.jar}"/>

but when I tried this it found one of the JVM manifests rather than
the velocity one.

I then tried <zipentry> instead, and this works:

<loadresource property="implementation.version">
<zipentry name="META-INF/MANIFEST.MF" archive="${velocity.jar}"/>
<filterchain>
<linecontains>
<contains value="Implementation-Version: "/>
</linecontains>
<tokenfilter>
<!-- Remove all but the revision number -->
<replaceregex pattern=".+: " replace=""/>
</tokenfilter>
</filterchain>
</loadresource>
<echo>${implementation.version}</echo>

However, this only applies if the script knows the name of the velocity jar.

If the jar is only available via a classpath, it gets a lot harder.

Maybe there should be an Ant task to look up / parse manifests...

>
>
>  On Mon, Jun 2, 2008 at 7:56 AM, sebb <se...@gmail.com> wrote:
>
>  > That's what I ended up doing:
>  >
>  > <available classpathref="anakia.classpath"
>  > classname="org.apache.velocity.io.UnicodeInputStream"
>  > property="velocity.version.15"/>
>  >
>  > But it would be nice if there was a simpler way to do this.
>  >
>  > On 02/06/2008, Claude Brisson <cl...@renegat.net> wrote:
>  > > You would typically check for the presence of a class that has been
>  > >  added since 1.5 - the typical getVersion() stuff hasn't been put yet in
>  > >  Velocity.
>  > >
>  > >
>  > >   Claude
>  > >
>  > >  Le vendredi 23 mai 2008 à 14:07 +0100, sebb a écrit :
>  > >
>  > > > How can one check the Velocity version from an Ant script?
>  > >  >
>  > >  > I had a problem with Anakia generating the wrong line endings on
>  > >  > Linux; turned out it was due to Ant picking up the wrong version of
>  > >  > the Velocity jar.
>  > >  >
>  > >  > It would be useful if one could check the version and report an error
>  > >  > if the version is earlier than  1.5 (say).
>  > >  >
>  > >
>  > > > ---------------------------------------------------------------------
>  > >  > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>  > >  > For additional commands, e-mail: user-help@velocity.apache.org
>  > >  >
>  > >
>  > >
>  > >  ---------------------------------------------------------------------
>  > >  To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>  > >  For additional commands, e-mail: user-help@velocity.apache.org
>  > >
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>  > For additional commands, e-mail: user-help@velocity.apache.org
>  >
>  >
>
>
>  --
>
> Forio Business Simulations
>
>
>  Will Glass-Husain
>  wglass@forio.com
>  www.forio.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: How to check Velocity version?

Posted by Will Glass-Husain <wg...@gmail.com>.
Is there a way to check the manifest file?



On Mon, Jun 2, 2008 at 7:56 AM, sebb <se...@gmail.com> wrote:

> That's what I ended up doing:
>
> <available classpathref="anakia.classpath"
> classname="org.apache.velocity.io.UnicodeInputStream"
> property="velocity.version.15"/>
>
> But it would be nice if there was a simpler way to do this.
>
> On 02/06/2008, Claude Brisson <cl...@renegat.net> wrote:
> > You would typically check for the presence of a class that has been
> >  added since 1.5 - the typical getVersion() stuff hasn't been put yet in
> >  Velocity.
> >
> >
> >   Claude
> >
> >  Le vendredi 23 mai 2008 à 14:07 +0100, sebb a écrit :
> >
> > > How can one check the Velocity version from an Ant script?
> >  >
> >  > I had a problem with Anakia generating the wrong line endings on
> >  > Linux; turned out it was due to Ant picking up the wrong version of
> >  > the Velocity jar.
> >  >
> >  > It would be useful if one could check the version and report an error
> >  > if the version is earlier than  1.5 (say).
> >  >
> >
> > > ---------------------------------------------------------------------
> >  > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> >  > For additional commands, e-mail: user-help@velocity.apache.org
> >  >
> >
> >
> >  ---------------------------------------------------------------------
> >  To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> >  For additional commands, e-mail: user-help@velocity.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

Re: How to check Velocity version?

Posted by sebb <se...@gmail.com>.
That's what I ended up doing:

<available classpathref="anakia.classpath"
classname="org.apache.velocity.io.UnicodeInputStream"
property="velocity.version.15"/>

But it would be nice if there was a simpler way to do this.

On 02/06/2008, Claude Brisson <cl...@renegat.net> wrote:
> You would typically check for the presence of a class that has been
>  added since 1.5 - the typical getVersion() stuff hasn't been put yet in
>  Velocity.
>
>
>   Claude
>
>  Le vendredi 23 mai 2008 à 14:07 +0100, sebb a écrit :
>
> > How can one check the Velocity version from an Ant script?
>  >
>  > I had a problem with Anakia generating the wrong line endings on
>  > Linux; turned out it was due to Ant picking up the wrong version of
>  > the Velocity jar.
>  >
>  > It would be useful if one could check the version and report an error
>  > if the version is earlier than  1.5 (say).
>  >
>
> > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>  > For additional commands, e-mail: user-help@velocity.apache.org
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>  For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org