When using ant, is there a way to specify a set of attribute/value pairs that can be passed to different tasks as a single item/variable?
I have an ant build file that includes several different javac tasks. All have the same values for several attributes (source, version, bootclasspath, debug, etc.)
I know that I can set a variable for each attribute; but, is there a way I can refer to the entire group of attributes so I can do something like this
<javac ${standard_attributes} ...>
instead of
<javac debug="on" includeantruntime="false" source="${java_version}" target="${java_version}" bootclasspath="${bcp}" ...
in every javac task?
Use presetdef
<presetdef name="standard-javac"> <javac debug="on" includeantruntime="false" source="${java_version}" target="${java_version}" bootclasspath="${bcp}" ... </javac> </presetdef>
and then use standard-javac
as a task in all places where you used to put javac
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.