Ant: How to use apply task with identical source and target file -
i trying run apply task following command:
jpegtran.exe -copy none -optimize -perfect ./images/file.jpg ./images/file.jpg
i apply recursively images. have tried following ant code jpegtran says invalid arguments.
<target name="optimize.images.jpg"> <apply executable="jpegtran.exe" dir="${src_dir}/public/assets/" parallel="false" verbose="true" resolveexecutable="true" force="true" vmlauncher="true"> <arg value="-copy none"/> <arg value="-optimize"/> <arg value="-perfect"/> <srcfile/> <targetfile/> <fileset dir="${src_dir}/public/assets/images" casesensitive="yes"> <include name="**/*.jpg"/> </fileset> <mapper type="identity"/> </apply> </target>
what wrong ant code?
one item needs changed nested <arg>
element -copy none
. since there space in argument, use line
attribute instead of value
. see apache ant command line arguments.
<target name="optimize.images.jpg"> <apply executable="jpegtran.exe" dir="${src_dir}/public/assets/" parallel="false" verbose="true" resolveexecutable="true" force="true" vmlauncher="true"> <arg line="-copy none"/> <arg value="-optimize"/> <arg value="-perfect"/> <srcfile/> <targetfile/> <fileset dir="${src_dir}/public/assets/images" casesensitive="yes"> <include name="**/*.jpg"/> </fileset> <mapper type="identity"/> </apply> </target>
Comments
Post a Comment