views:

220

answers:

1

Is there a way in Ant which can check that a specified properties file only contains unique keys? A build failure would be the required behaviour if any duplicates are found.

+2  A: 

rscbundlecheck does the duplicate key check and more validations suitable for internationalization. Blurb from their website:

Ant Task for checking Java Resourcebundles. It checks for existence of all keys in each bundle, duplicate keys, existence of forbidden chars (e.g. special characters like umlauts) and continuous usage of placeholders.

Example ant script:

<taskdef name="resourceCheck" classpathref="build.classpath" classname="org.dyndns.fichtner.rsccheck.ant.RscBundleCheckTask"/>
<resourceCheck>
 <fileset file="my-properties-file.properties"/>
</resourceCheck>

Where build.classpath contains the resourceCheck binary jar available here

Peter