Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a way to set ant -verbose inside build.xml?

I would like to get verbose console output while building from eclipse and hudson.

There seems to be no verbose property for <target> and <project> and it seems very wrong to call <exec> on ant from inside the script just to pass the verbose prop.

Is there a better way?

like image 816
kostja Avatar asked Mar 08 '11 12:03

kostja


People also ask

How do I build an Ant build xml?

Create Ant build file In the Project tool window, select the directory, where the build file should be created. Right-click the directory and from the context menu, select New | File ( Alt+Insert ). In the New File dialog, specify the name of the new file with the xml extension, for example, build. xml.

How do I run an Ant file in xml?

To run the ant build file, open up command prompt and navigate to the folder, where the build. xml resides, and then type ant info. You could also type ant instead. Both will work,because info is the default target in the build file.


2 Answers

You could use Ant's <record> task (http://ant.apache.org/manual/Tasks/recorder.html) to get verbose logging to a file. If this task is defined early in the build file, you should get logging for all build tasks. You could also start and stop the recorder anywhere in your build file. This could, for example, allow you to not log the output of some task that you do not want to see in the log file.

Here's an example of a simple build file that uses the <record> task:

<?xml version="1.0" encoding="UTF-8"?> <project default="all" basedir=".">   <record name="build.log" loglevel="verbose" action="start" />   <target name="all">     <path id="all.files">       <fileset dir="." includes="**/*" />     </path>     <property name="files" refid="all.files" />     <echo level="verbose">files=${files}</echo>   </target> </project> 
like image 89
Dan Cruz Avatar answered Sep 19 '22 14:09

Dan Cruz


It will be an eclipse External Tools Configuration parameter (under Run -> External Tools). Please see the screenshot below:

enter image description here

like image 34
adarshr Avatar answered Sep 20 '22 14:09

adarshr