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
Micro Focus Visual COBOL Development Hub, the application is built on the machine running Ant. This is how you use
.cobolBuild to build a project:
- From a
command prompt:
-
ant -lib $COBDIR/lib/mfant.jar -f .cobolBuild
Note: When compiling to multiple executables from the command line, you must specify the
-logger parameter to enable the correct log to be output to the console:
-logger com.microfocus.ant.CommandLineLogger
Alternatively, 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
- From the Eclipse IDE:
-
- Click
Window > Preferences > Run/Debug > Launching and clear the
Build (if required) before launching option, if you don't want to trigger an Eclipse build before each Ant build.
- In COBOL Explorer, right-click the
.cobolBuild file and click
Run As > Ant Build.
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:
- Right-click your project in the COBOL Explorer view and click
Properties.
- Expand
Micro Focus > Build Configurations and click
Events for the desired configuration.
- Type the code of the script either in the
Pre-build event command line or in the
Post-build event command line field.
- Click
Apply and then click
OK.
Note:
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:
- Right-click your project in COBOL Explorer, then click
Properties > Resource > Linked Resources.
- See the variables listed on the
Path Variables tab.