ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <jakarta-...@ehatchersolutions.com>
Subject Re: Conditional compilation
Date Wed, 12 Jun 2002 22:44:29 GMT
You're bound to get a flood of replies to this:

<property name="build.debug" value="true"/>
<javac debug="${build.debug}">

then run with: ant -Dbuild.debug=false to turn it off.

So yes, there is a vastly better way!

    Erik

----- Original Message -----
From: <kynn@panix.com>
To: "Ant Users List" <ant-user@jakarta.apache.org>
Sent: Wednesday, June 12, 2002 5:50 PM
Subject: Conditional compilation


>
>
>
>
> 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>
>
>   <target name="compilewithdebug" if="DEBUG>
>     <javac debug="on"/>
>   </target>
>
>   <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?
>
> Thanks!
>
> kynn
>
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message