Setting up the Environment

In most cases, your Jenkins projects execute tasks in a command line environment and not inside the Enterprise Developer 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 Enterprise Developer for Eclipse:

  1. Ensure Enterprise Developer is installed on the machine you are going to use to build, test or analyze the COBOL sources.
  2. In Jenkins, go to the Build section of your project's configuration.
  3. Depending on the platform where your project executes, add either a Windows batch command (Windows) or a shell (UNIX) build step.
  4. Specify the following commands in the step, each one on a new line:
    1. (Windows) Invoke the Enterprise Developer setupenv.bat file to set the required environment variables:
      call "product-install-dir\setupenv.bat"

      (UNIX) Call the cobsetenv script:

      . /opt/MicroFocus/EnterpriseDeveloper/bin/cobsetenv

      This sets the following environment variables - COBDIR, PATH, CLASSPATH and LD_LIBRARY_PATH (or LIBPATH on AIX).

    2. Set the JAVA_HOME environment variable:
      • Windows:
        set JAVA_HOME=JDKInstallDir
      • UNIX:
        export JAVA_HOME=java-install-dir
        export PATH=$PATH:java-install-dir/bin
    3. 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 Enterprise Developer 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 Enterprise Developer:
  1. From an Enterprise Developer command prompt, execute the following command:
    cblpromp.exe -j

    This displays a list of the environment variables set for Enterprise Developer in the command prompt.

  2. 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:
  1. Install the Environment Injector plugin in Jenkins.
  2. In the configuration area of your project, navigate to the Build Environment section.
  3. Check Prepare an environment for the run.
  4. In the Properties File Path section, specify the full path to the env.properties file.