You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by ji...@svensktnaringsliv.se on 2013/07/03 09:47:50 UTC
Sending options to ANT task? Specifically the -q option to make it
quiet
Hi all,
I have a build file that in turn calls another build file, using the ANT task (http://ant.apache.org/manual/Tasks/ant.html). However, I want to make that second build file run in "quiet mode", ie just as if I had triggered it from a command line with the "-q" option. How can I do that using the ANT task? I fail to find any documentation on how to send options like this with the ANT task.
I have tried various things using the property tag, with no success, like this:
<ant dir="${otherBuildFolderPath}" inheritAll="false">
<target name="clean" />
<target name="ear" />
<property name="-q" value="" />
<property name="" value="-q" />
<property name="quiet" value="true" />
</ant>
I also tried this, but it resulted in an error:
<ant dir="${otherBuildFolderPath}" inheritAll="false">
<target name="clean" />
<target name="ear" />
<arg value="-q"/>
</ant>
Any help is appreciated.
Regards
/Jimi
AW: Sending options to ANT task? Specifically the -q option to make it quiet
Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
You cannot reconfigure the logger Ant uses.
You have to start a complete new Ant instance.
Jan
sample:
<project default="test">
<target name="print">
<echo level="info" message="1-info"/>
<echo level="error" message="2-error"/>
<echo level="info" message="3-info"/>
</target>
<target name="test">
<echo level="info" >Call via 'ant'</echo>
<ant target="print"/>
<echo level="info" >Call via 'java'</echo>
<ant2 antfile="./build.xml" target="print">
<arg value="-q"/>
</ant2>
</target>
<macrodef name="ant2">
<attribute name="antfile"/>
<attribute name="target"/>
<element name="ant2-args" implicit="yes"/>
<sequential>
<java classname="org.apache.tools.ant.Main">
<arg value="@{target}"/>
<ant2-args/>
</java>
</sequential>
</macrodef>
</project>
> -----Ursprüngliche Nachricht-----
> Von: jimi.hullegard@svensktnaringsliv.se
> [mailto:jimi.hullegard@svensktnaringsliv.se]
> Gesendet: Mittwoch, 3. Juli 2013 09:48
> An: user@ant.apache.org
> Betreff: Sending options to ANT task? Specifically the -q option to
> make it quiet
>
> Hi all,
>
> I have a build file that in turn calls another build file, using the
> ANT task (http://ant.apache.org/manual/Tasks/ant.html). However, I want
> to make that second build file run in "quiet mode", ie just as if I had
> triggered it from a command line with the "-q" option. How can I do
> that using the ANT task? I fail to find any documentation on how to
> send options like this with the ANT task.
>
> I have tried various things using the property tag, with no success,
> like this:
>
>
> <ant dir="${otherBuildFolderPath}" inheritAll="false">
> <target name="clean" /> <target name="ear" />
> <property name="-q" value="" /> <property name="" value="-q" />
> <property name="quiet" value="true" /> </ant>
>
> I also tried this, but it resulted in an error:
>
> <ant dir="${otherBuildFolderPath}" inheritAll="false">
> <target name="clean" /> <target name="ear" />
> <arg value="-q"/> </ant>
>
>
> Any help is appreciated.
>
> Regards
> /Jimi
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org