Before you use Apache Ant you need to perform the following set up:
Once you have Apache Ant installed, you need to configure your environment:
EXPORT ANT_HOME=<ant_path>
EXPORT PATH=$PATH:<ant_path>/bin
Visual COBOL uses an Apache Ant script, .cobolBuild, to build COBOL projects. This script is automatically generated from the .cobolProj project file.
Existing external build scripts such as makefiles, MSBuild, shell scripts and others can build COBOL applications using .cobolBuild as an Ant build file.
If you use an Ant file from a project developed on a remote machine using the Visual COBOL Development Hub, the application is built on the machine running Ant.
ant -lib $COBDIR/lib/mfant.jar -f .cobolBuild
You can compile your source code faster on multi-CPU machines if you use parallel compilation. To do this, you must add the mf.buildThreadCount=nn parameter. Where nn specifies the number of CPU threads to use:
ant -lib $COBDIR/lib/mfant.jar -f .cobolBuild -Dmf.buildThreadCount=2
ant -lib $COBDIR/lib/mfant.jar -f .cobolBuild -Dmf.forceCompile=false
For UNIX:
export CLASSPATH=$CLASSPATH:$COBDIR/lib/mfant.jar
For Windows:
SET CLASSPATH=%CLASSPATH%;$COBDIR\bin\mfant.jar
-logger com.microfocus.ant.CommandLineLoggerAlternatively, you can specify the -logger option as an environment variable as follows:
set ANT_ARGS=-logger com.microfocus.ant.CommandLineLogger
export ANT_ARGS=-logger com.microfocus.ant.CommandLineLogger
You can set your own shell scripts as pre- or post-build events and they execute as part of the .cobolBuild Ant script before or after compiling.
To set pre- or post-build events:
If you reference variables in the Events field, you must prefix any linked resource path variables with ${pathVar. and terminate the variable with }. For example, code PROJECT_LOC as ${pathVar.PROJECT_LOC}.
Linked resources path variables are defined in the project's properties as follows: