In most cases, your Jenkins projects execute tasks in a command line environment and not inside the
Visual COBOL IDE. This means that the COBOL environment is not automatically preconfigured as it would be if you used the IDE. As a result,
when you use Jenkins projects you typically need to manually set the COBOL environment for your projects.
Note: If you use scripts to build your applications, then the scripts might already include the commands for setting the COBOL environment.
In this case, you do not need to specify the environment in Jenkins - you only need to configure Jenkins to run the scripts.
To configure the environment for applications created with
Visual COBOL for Eclipse:
- Ensure
Visual COBOL is installed on the machine you are going to use to build, test or analyze the COBOL sources.
- In Jenkins, go to the
Build section of your project's configuration.
- Depending on the platform where your project executes, add either a Windows batch command (Windows) or a shell (UNIX) build
step.
- Specify the following commands in the step, each one on a new line:
- (Windows) Invoke the
Visual COBOL
setupenv.bat file to set the required environment variables:
call "product-install-dir\setupenv.bat"
(UNIX) Call the
cobsetenv script:
. product-install-dir/bin/cobsetenv
This sets the following environment variables - COBDIR, PATH, CLASSPATH and LD_LIBRARY_PATH (or LIBPATH on AIX).
- Set the JAVA_HOME environment variable:
- Specify the required Ant options:
set ANT_OPTS=-Xmx1024m
Tip: If your projects execute any tasks on agent machines, you can set JAVA_HOME from the configuration page of the node for that
machine.
See the
rest of the
Visual COBOL product help for more command line options you can specify.
Tip: Optionally, you can create a file that includes all of the required environment variables and configure your project to use
it. To do this, you first need to obtain a list of all environment variables that are set in
Visual COBOL:
- From
a
Visual COBOL command prompt, execute the following command:
cblpromp.exe -j
This displays a list of the environment variables set for
Visual COBOL in the command prompt.
- Save the list to a file on your machine such as
env.properties.
Tip: Next, configure your project to use the variables specified in this file:
- Install the Environment Injector plugin in Jenkins.
- In the configuration area of your project, navigate to the
Build Environment section.
- Check
Prepare an environment for the run.
- In the
Properties File Path section, specify the full path to the
env.properties file.