CFCompile Ant snippet

June 19, 2008 by Mike Henke    No Comments
Posted under: Ant · ColdFusion

I have been working on a build.xml file for work that updates the local working copy, runs MXunit tests, create JUnit reports based on MXunit results, minifies js/css, grabs only modified files between revisions, crunches ColdFusion files, checks compile errors, and also will check for unscoped vars in cfcs using varScoper.

Here is a snippet for the checking ColdFusion compiling using cfcompile. I'll release the full build.xml, lib, and buildprops when I have the unscoped var target working.

Compiles the ColdFusion files for any syntax errors
<target name="compileCheck">
<echo>Check Coldfusion Compile for ${webroot}${temp.dir}${jarfileTstamp}</echo>

<exec failonerror="true" dir="${cfcompile_path}" executable="cmd.exe" output="${webroot}${temp.dir}${jarfileTstamp}compile${jarfileTstamp}.txt" >
<env key="JAVA_HOME" value="${JAVA_HOME}"/>
<arg line="/c cfcompile.bat ${webroot}${temp.dir}${jarfileTstamp}" />
<!— need to check log for failures —>
<loadfile srcfile="${webroot}${temp.dir}${jarfileTstamp}compile${jarfileTstamp}.txt" property="src.file.cferrors">
<regexp pattern="Error*"/>
<isset property="src.file.cferrors"/>

Related Posts:

Use eclipse, ant and cfcompile.bat to precompile your code

Snarling radioactive ants!