Is there a way I can modify a file in a jar using ant script. Like, I have a x.properties in a y.jar. I want to edit this x.properties and put it back into the y.jar using ant script. Is this possible?
A:
jar -xvf <filename>
extracts a file out of a jar.
jar -uvf <filename>
can update a file in the jar.
You can use a script to do this and then use Ant to call the script.
Rahul
2010-07-16 06:25:20
+1
A:
To extract a file from a jar:
<unjar src="y.jar" dest="build">
<patternset>
<include name="x.properties"/>
</patternset>
</unjar>
To add it back in:
<jar jarfile="y.jar" update="true">
<fileset dir="." includes="x.properties"/>
</jar>
Mark O'Connor
2010-07-16 23:22:55
A:
I usually unpack the whole jar file, alter the file I want to alter, and then create a new jar file. I is probably not the fasted way, but my build scrips are not time critical.
FrankB
2010-07-21 11:44:31