I think it would be convenient to have command-line arguments take optional if/unless attributes that work much like those on targets. My use case is with the <javac> task where I want to conditionally pass in an -Xlint option:
<javac source="${java_compiler-source-version}" target="${java_compiler-target-version}" debug="${java_compiler-debug}" deprecation="${java_compiler-deprecation}" includeAntRuntime="false" verbose="${java_verbose}"> <compilerarg value="-Xlint" if="${java_lint}" /> . . . </javac> I think my only choice now is to play games with the compiler attribute on compilerarg: use a <condition> to set the compiler to a bogus value, something like this: <condition property="java_compilerarg-lint" value="modern" else="***disabled"> <istrue value="${java_lint}" /> </condition> <javac source="${java_compiler-source-version}" target="${java_compiler-target-version}" debug="${java_compiler-debug}" deprecation="${java_compiler-deprecation}" includeAntRuntime="false" verbose="${java_verbose}"> <compilerarg value="-Xlint" compiler="${java_compilerarg-lint}" /> . . . </javac> If there's consensus that this is generally useful I'll write up a formal feature request. Rich