Previous Topic Next topic Print topic


To build a project using Apache Ant

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.
From a Windows command prompt:
ant -lib %ProgramFiles(x86)%\Micro Focus\Visual COBOL\bin\mfant.jar -f .cobolBuild
From a UNIX command prompt:
ant -lib $COBDIR/lib/mfant.jar -f .cobolBuild
From the Eclipse IDE
  1. Choose 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.
  2. Right-click the .cobolBuild file and select Run As > Ant Build.

You can set your own shell scripts as pre-build and post-build events and they will execute as part of the .cobolBuild Ant script before or after compiling.

To set pre-build and post-build events:

  1. Right-click on your project in the COBOL Explorer view and select Properties.
  2. Expand Micro Focus > Build Configurations and click Events for the desired configuration.
  3. Type the code of the script in the Pre-build event command line field or Post-build event command line field.
  4. Click Apply and then OK.
Note:

If you reference variables within Events, you must prefix any linked resource path variables with ${pathVar. and terminate the variable with }, for example - you must code PROJECT_LOC as ${pathVar.PROJECT_LOC}. Linked resource path variables are defined on the project properties page. Right-click your project, and then click Properties > Resource > Linked Resources. The variables are listed on the Path Variables tab.

Previous Topic Next topic Print topic