ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ludwig <mil...@gmx.de>
Subject Re: Remove duplicate JAR file names from an XML file
Date Sat, 31 Jul 2010 17:19:10 GMT
Gilbert Rebhan schrieb am 31.07.2010 um 14:50 (+0200):
> > Gilbert Rebhan schrieb am 31.07.2010 um 00:47 (+0200):

> > Should be using a regex here: getProperty("alljars").split("\\s+");
> > That will take care of linebreaks and tabs, not only spaces.
> 
> not required in that case, as xmltask uses a blank as default

I think that was for the case of a whitespace-separated list of jars
taken from the XML by using the text() node test.

> > <project>
> >   <file file="res.txt" id="input"/>
> >   <union id="tokens">
> >     <sort>
> >       <tokens>
> >         <resources refid="input"/>
> >         <stringtokenizer/>
> >       </tokens>
> >     </sort>
> >   </union>
> >   <pathconvert refid="tokens"
> >     pathsep="${line.separator}"
> >     property="tokens2" />
> >   <echo message="${tokens2}"/>
> > </project>

Looks like the <union> is not needed in this case as <pathconvert>
seems to imply removal of duplicates.

> <pathconvert property="uniquejars" pathsep=",">
>  <union>
>   <sort>
>    <tokens>
>     <propertyresource name="alljars"/>
>     <stringtokenizer/>
>    </tokens>
>   </sort>
>  </union>
> </pathconvert>

Same here, you can drop the <union> and get the same result.

> if you like perl, you may like (j)ruby or groovy
> for scripting in ant <script ../> <scriptdef ../>
> Sometimes it's easier to write a small script before
> using too much clumsy xml or writing a new task.
> 
> Also try ant-flaka [1], which aims to simplify writing ant files.
> i just started using it, and it rocks :-)

> [1] http://code.google.com/p/flaka/

Thanks, looks interesting!

Best,
-- 
Michael Ludwig

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


Mime
View raw message