I have an ant build script with a fairly complex <exec>
command with lots of <arg>
tags that I'm trying to troubleshoot. I was wondering if it is possible to view the entire command line after ant has constructed it; either in the eclipse debugger or maybe by dumping it to a file.
Here's what I'm dealing with:
<exec executable='"@{sdk}/bin/mxmlc.exe"' failonerror="true" >
<arg line='-load-config "@{sdk}/frameworks/flex-config.xml"'/>
<!-- Flex Build Path -->
<!-- Source path -->
<!-- Main source folder: -->
<arg line='-compiler.source-path "@{project-dir}/src"'/>
<!-- Additional source folders outside of the main source folder: -->
<arg line='-compiler.source-path "@{project-dir}/inc/swf"'/>
<arg line='-compiler.source-path "@{project-dir}/inc/images"'/>
<!-- Output folder: -->
<arg line='-output "@{output}"'/>
<!-- Library path -->
<!-- Build path libraries: -->
<arg line='-compiler.library-path "@{libs}"'/>
<arg line='-compiler.library-path "@{sdk}/frameworks/libs"'/>
<arg line='-compiler.library-path "@{sdk}/frameworks/locale/en_US"'/>
<arg line='-compiler.library-path "${dcradswcs.flex.path}/libs"'/>
<arg line='-compiler.library-path "${dcradswcs.flex.path}/locale"'/>
<arg line='-compiler.library-path "${fiberswcs.flex.path}/libs"'/>
<arg line='-compiler.library-path "${fiberswcs.flex.path}/locale"'/>
<arg line='-compiler.library-path "${flexunitframework.flex.path}/flexunitframework/libs/version4libs/Common"'/>
<arg line='-compiler.library-path "${flexunitframework.flex.path}/flexunitframework/libs/version4libs/FlexProject"'/>
<arg line='-compiler.library-path "${flexunitframework.flex.path}/flexunitframework/locale/version4locale"'/>
<arg line='-compiler.library-path "${flexunitframework.flex.path}/flexunitframework/libs"'/>
<!-- <arg line='-compiler.library-path "C:/rms-it-apps/adobe/fb4/plugins/com.adobe.flexbuilder.dcrad_4.0.1.277662/dcradSwcs/4.0/libs"'/>
<arg line='-compiler.library-path "C:/rms-it-apps/adobe/fb4/plugins/com.adobe.flexbuilder.dcrad_4.0.1.277662/dcradSwcs/4.0/locale"'/>
<arg line='-compiler.library-path "C:/rms-it-apps/adobe/fb4/plugins/com.adobe.flexbuilder.dcrad_4.0.1.277662/fiberSwcs/4.0/libs"'/>
<arg line='-compiler.library-path "C:/rms-it-apps/adobe/fb4/plugins/com.adobe.flexbuilder.dcrad_4.0.1.277662/fiberSwcs/4.0/locale"'/>
<arg line='-compiler.library-path "C:/rms-it-apps/adobe/fb4/plugins/com.adobe.flexbuilder.flexunit_4.0.1.277662/flexunitframework/libs/version4libs/Common"'/>
<arg line='-compiler.library-path "C:/rms-it-apps/adobe/fb4/plugins/com.adobe.flexbuilder.flexunit_4.0.1.277662/flexunitframework/libs/version4libs/FlexProject"'/>
<arg line='-compiler.library-path "C:/rms-it-apps/adobe/fb4/plugins/com.adobe.flexbuilder.flexunit_4.0.1.277662/flexunitframework/locale/version4locale"'/>
<arg line='-compiler.library-path "C:/rms-it-apps/adobe/fb4/plugins/com.adobe.flexbuilder.flexunit_4.0.1.277662/flexunitframework/libs"'/> -->
<!-- Runtime shared libraries. Order matters. -->
<!-- Load framework libraries first -->
<arg line='-runtime-shared-library-path="@{sdk}/frameworks/libs/textLayout.swc","textLayout_1.1.0.604.swz",,"textLayout_1.1.0.604.swf"'/>
<arg line='-runtime-shared-library-path="@{sdk}/frameworks/libs/osmf.swc","osmf_flex.4.0.0.13495.swz",,"osmf_flex.4.0.0.13495.swf"'/>
<arg line='-runtime-shared-library-path="@{sdk}/frameworks/libs/framework.swc","framework_4.1.0.16076.swz",,"framework_4.1.0.16076.swf"'/>
<arg line='-runtime-shared-library-path="@{sdk}/frameworks/libs/spark.swc","spark_4.1.0.16076.swz",,"spark_4.1.0.16076.swf"'/>
<arg line='-runtime-shared-library-path="@{sdk}/frameworks/libs/sparkskins.swc","sparkskins_4.1.0.16076.swz",,"sparkskins_4.1.0.16076.swf"'/>
<arg line='-runtime-shared-library-path="@{sdk}/frameworks/libs/rpc.swc","rpc_4.1.0.16076.swz",,"rpc_4.1.0.16076.swf"'/>
<arg line='-runtime-shared-library-path="@{sdk}/frameworks/libs/datavisualization.swc","datavisualization_4.1.0.16076.swz",,"datavisualization_4.1.0.16076.swf"'/>
<!-- Load after framework libraries -->
<!-- Note: do not put spaces between comma delimited values -->
<arg line='${rsl.applicationSettings}'/>
<arg line='${rsl.authorization}'/>
<arg line='${rsl.autofill}'/>
<arg line='${rsl.customComponents}'/>
<arg line='${rsl.navigation}'/>
<arg line='${rsl.lookup}'/>
<!-- Libraries needed for QTP -->
<arg line="${qtp.arg1}"/>
<arg line="${qtp.arg2}"/>
<arg line="${qtp.arg3}"/>
<arg line="${qtp.arg4}"/>
<arg line="${qtp.arg5}"/>
<arg line="-verify-digests=false"/>
<!-- Flex Compiler -->
<!-- Compiler options -->
<arg line="-compiler.accessible=true"/>
<arg line="-compiler.strict=true"/>
<arg line="-warnings=true" />
<!-- Additional compiler arguments: -->
<arg line='-theme=@{sdk}/frameworks/themes/Halo/halo.swc -services "@{services-config}" -locale en_US'/>
<!-- Flex Server -->
<!-- Server location -->
<!-- Context root: -->
<arg line="-compiler.context-root=@{context-root}"/>
<!-- Miscellaneous -->
<arg line="-compiler.incremental=true"/>
<arg line="-compiler.keep-generated-actionscript=false"/>
<arg line="-compiler.verbose-stacktraces=true"/>
<arg line="-show-unused-type-selector-warnings=false"/>
<arg line="-optimize=true" />
<arg line="-debug=@{debug}" />
<arg line='"@{mxml}"'/>
</exec>
This is the error I'm getting:
BUILD FAILED
C:\dev\workspace\rmsitepi2\build.raytheon.suite.tomcat.xml:50: The following error occurred while executing this line:
C:\dev\workspace\rmsitepi2\build.raytheon.flex.xml:33: The following error occurred while executing this line:
C:\dev\workspace\rmsitepi2\build.raytheon.flex.xml:159: exec returned: 1
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.
exit(0);</script> ain't complicated, in fact it's the most simple.
To run Ant build in debug or verbose mode in command prompt, we can simply use the -d or -debug (for debug mode) and -verbose (for verbose mode). This gives us deep insight into any error we might be facing with the Ant build.
Sometimes, project's task require arguments which will be passed to another process by using command line. Ant allows command line arguments, even arguments which contains space characters. It supports <arg> element to pass arguments and uses various attribute given below.
ant -v usually does the trick but you may find you have a lot of output to look through.
What about some good old echoing via:
<echoxml>
<exec executable="..." failonerror="true" >
<arg value="..."/>
<arg value="..."/>
...
</exec>
</echoxml>
for testing your stuff (attribute values, properties resolved .. etc.) before activating the real thing !?
That's what I use frequently, because ant -verbose | debug
is too chatty when I need to check only specific parts. Afterwards simply delete or comment the echoxml
tags.
For echoxml you need Ant >= 1.7
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With