ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rao Chaudhri" <rchaud...@1fbusa.com>
Subject RE: AW: Remove duplicate JAR file names from an XML file
Date Tue, 27 Jul 2010 20:32:31 GMT

Did sort of like a similar thing:
I am using string comparison to get rid of duplications, using a for loop to iterate through
the list of JAR files and in each iteration I store the name of the JAR file in a temporary
variable and than do a comparison of the current property with the temporary variable in the
next iteration.

Thanks

Usman Chaudhri

-----Original Message-----
From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de] 
Sent: Monday, July 26, 2010 11:33 PM
To: user@ant.apache.org
Subject: AW: Remove duplicate JAR file names from an XML file

>I have an xml file which lists JAR file names in it with space 
>specified as a delimiter. There are duplications of JAR files 
>name in the file and I was wondering if there is a way to some 
>how get ride of the duplication, to get a file which has a 
>unique set of JAR file names?
> 
>
>Example of file:
>
>antlr-2.7.6.jar antlr-2.7.6.jar antlr-2.7.6.jar 
>aopalliance-1.0.jar aopalliance-1.0.jar aopalliance-1.0.jar 
>commons-validator-1.0.2.jar commons-validator-1.0.2.jar 
>commons-lang-2.2.jar commons-lang-2.2.jar


I dont see any built-in possibility so you have to script/program your
own task.
- you could read the xml with <xmlproperty>
- adress the list as property
- split the property value and store it in a set
- change the set into a space delimited list and store it as property
- copy the xml file with replacing ${xml-property} by
${calculated-property}

Just my 5ct ;)


Jan

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




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


Mime
View raw message