I have an Ant build with a lot of javac tasks. I want all of them to be executed with the following attributes:

debug = "true" debuglevel = "lines,vars,source"

(by default debugging information is turned off which makes it harder to investigate the console).

Is it possible to provide such attributes in some centralized place which will have influence for all javac tasks in current Ant build? (I don't want duplicating them over all javac tasks...)

有帮助吗?

解决方案

You need ant's presetdef

From the example

<presetdef name="my.javac">
   <javac debug="${debug}" deprecation="${deprecation}"
          srcdir="${src.dir}" destdir="${classes.dir}">
      <src path="${gen.dir}"/>
   </javac>
</presetdef>

Instead of my.javac, you can put javac.

You can define this in one build file and import every where else.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top