ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Conditional compilation
Date Wed, 12 Jun 2002 21:50:38 GMT

Hi!  I want to be able to invoke 'ant -DDEBUG=1' whenever I want my
project to be compiled with javac's -g flag.  How do I write the build
file for this?  One klunky way would be something like

  <target name="compile" unless="DEBUG>
    <javac debug="off"/>

  <target name="compilewithdebug" if="DEBUG>
    <javac debug="on"/>

  <target name="dist" depends="compile,compilewithdebug"/>

But that's a lot of machinery for a simple conditional!  (Not to
mention that it is ugly.)  Is this the only way?



To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message