commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Lynch" <peterly...@mindspring.com>
Subject Re: [Jelly] Ant <filterset> in jelly script issues
Date Wed, 20 Nov 2002 20:59:23 GMT
dIon,

The only case I have seen them work is when the "filtering" attribute of the
copy task is 'on' _and_ the filterset tokens are defined from within a filterset
nested inside the copy task.

A filterset nested inside the copy task defining tokens with filtering attribute
not there did not work for me.

That seems doubly broken as the filtering attribute should only affect global
filters.

With filtering on and only a global filterset defined ( not nested inside the
copy task ) the filtereing does not work.

-Peter

----- Original Message -----
From: <dion@multitask.com.au>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Wednesday, November 20, 2002 9:48 AM
Subject: Re: [Jelly] Ant <filterset> in jelly script issues


> Peter,
>
> do filtersets nested in the <copy> work ok?
> --
> dIon Gillard, Multitask Consulting
> Blog:      http://www.freeroller.net/page/dion/Weblog
> Work:      http://www.multitask.com.au
>
>
> "Peter Lynch" <peterlynch@mindspring.com> wrote on 20/11/2002 05:33:25 PM:
>
> > Hello,
> >
> > I tried to write a Jelly Unit test case for Ant filtersets. Thanks James
> > Strachan for the pointers.
> >
> > Here is my test case I used:
> >
> > <!-- test case to show how filtersets are broken -->
> > <test:case name="antFilterset">
> >
> >   <ant:filterset id="maven.webserver.filterset.default">
> >       <ant:filter token="maven.webserver.home" value="some dir" />
> >   </ant:filterset>
> >   <ant:copy
> file="src/test/org/apache/commons/jelly/ant/AntFilterset.txt"
> > tofile="src/test/org/apache/commons/jelly/ant/AntFilterset.properties">
> >     <ant:filterset refid="maven.webserver.filterset.default" />
> >   </ant:copy>
> > </test:case>
> >
> >
> > [java] [ERROR] AntTag - -Class
> org.apache.commons.jelly.tags.junit.CaseTag
> > doesn't support the nested "filterset" element.
> >     [java]      [echo]
> >     [java]      [echo]
> >     [java]      [copy] Copying 1 file to
> > G:\cygwin\home\plynch\dev\apache\jakarta-commons-
> > sandbox\jelly\src\test\org\apac
> > he\commons\jelly\ant
> >
> >
> > Before the copy AntFilterset.txt file contains simply:
> >
> > maven.webserver.home=@maven.webserver.home@
> >
> > After the copy, u guessed it:
> >
> > maven.webserver.home=@maven.webserver.home@
> >
> >
> > Needless to say the filter token was not replaced in the copied
> > file. Something
> > needs to be done in order for the filterset to be nested in the case tag
> for
> > starters.
> >
> > To assert if the filter succeeds, I was going to read in the copied
> property
> > file and then test the property in the AntFilterset.properties for it's
> value.
> >
> > Please note...
> >
> > This failed case has been around in Maven for a long time. To reproduce
> in
> > Maven, define a goal similar to this one, assuming all properties are
> set in a
> > plugin.properties:
> >
> > <goal name="testFilterset">
> >
> >     <ant:filterset id="maven.webserver.filterset.default">
> >       <ant:filter token="maven.webserver.home"
> value="${maven.webserver.home}"
> > />
> >       <ant:filter token="maven.webserver.name"
> value="${maven.webserver.name}"
> > />
> >       <ant:filter token="maven.webserver.version"
> > value="${maven.webserver.version}" />
> >       <ant:filter token="maven.webserver.port.http"
> > value="${maven.webserver.port.http}" />
> >       <ant:filter token="maven.webserver.port.https"
> > value="${maven.webserver.port.https}" />
> >       <ant:filter token="maven.webserver.port.one"
> > value="${maven.webserver.port.one}" />
> >       <ant:filter token="maven.webserver.port.two"
> > value="${maven.webserver.port.two}" />
> >       <ant:filter token="maven.webserver.port.three"
> > value="${maven.webserver.port.three}" />
> >       <ant:filter token="maven.webserver.conf.dir"
> > value="${maven.webserver.conf.dir}" />
> >       <ant:filter token="maven.webserver.host"
> value="${maven.webserver.host}"
> > />
> >     </ant:filterset>
> >
> >
> >     <!-- copy any user configuration files w/ filtering by forcing copy
> -->
> >     <!-- expecting at least a httpd.conf -->
> >     <ant:copy todir="${maven.webserver.dir}" overwrite="true">
> >           <ant:fileset dir="${maven.webserver.conf.dir}" />
> >           <ant:filterset refid="maven.webserver.filterset.default" />
> >           <ant:filterset refid="maven.webserver.filterset" />
> >     </ant:copy>
> > </goal>
> >
> > Any files copied that contain any tokens do not get filtered with
> > their property
> > value.
> >
> > The only case I have found filtersets to work is demonstrated by Maven
> Cactus
> > plugin. Here is an example from Maven's Cactus plugin:
> >
> > <copy todir="${maven.cactus.build.resources.dir}"
> >       file="${maven.cactus.configFile}" filtering="on">
> >       <filterset>
> >         <filter token="maven.cactus.port" value="${maven.cactus.port}"/>
> >       </filterset>
> > </copy>
> >
> > Poor Vincent ( Cactus plugin developer ) seems to be fooling himself
> that
> > filtersets are playing happily, and by rights he does get the token
> > replaced in
> > his copied file. ( Hi Vincent :)
> >
> > In this case the port number from plugin.properties gets replaced, but
> only
> > because the attribute filtering="on" is there and the nested filterset
> is not
> > using a refid. Not to mention that the nested filterset should work
> without
> > filtering="on" as per the Ant docs re that attribute of the copy task:
> >
> > From Ant documentation:
> > " Indicates whether token filtering using the global build-file filters
> should
> > take place during the copy. Note: Nested <filterset> elements will
> always be
> > used, even if this attribute is not specified, or its value is false
> (no, or
> > off). "
> >
> > I looked at Jelly's AntTag.java off and on over the past month
> > trying to figure
> > out
> > how to fix this, but no luck so far. This one haunts me.
> >
> > ( Attention Maven users: Any proposed fix should also consider what
> > happens when
> > the filterset is defined in a prereq goal and referenced inside a
> > goal inside an
> > jelly script imported into the script which defines the filterset. :) )
> >
> > Any Jelly gurus know what is up?
> >
> > -Peter
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:commons-dev-help@jakarta.apache.org>
> >
>
> > ForwardSourceID:NT00090B1A
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message