Managing IBM JZOS dependencies by using Maven

When developers write build scripts for Java™ applications, they can use build toolchains, such as Maven, to resolve dependencies for the JZOS library that is provided with IBM® Semeru Runtime Certified Edition for z/OS®. The build toolchains can retrieve libraries from the Maven central repository or an enterprise mirror server.

Most Java integrated development environments (IDEs) and automation tools such as Jenkins and Travis CI support Maven. This support provides easy integration with the compilation, building, and deployment of Java applications for z/OS into a pipeline during development.

Important: The JZOS .jar file that is available on Maven Central is a stub .jar file, which can be used only for the purposes of building and compiling. This .jar file is not intended for runtime testing of the JZOS API.

Available JZOS artifacts

The following table shows the JZOS artifacts that are available on Maven Central.

Table 1. JZOS artifacts available on Maven Central
Group ID Artifact ID Description
com.ibm.jzos ibm.jzos Java Batch Launcher and Toolkit for z/OS (JZOS) is a set of tools that help you develop z/OS Java applications that run in a traditional batch environment and access z/OS system services.

The version on Maven Central is a stub version of the JZOS .jar file, and is for use only for building and compiling applications.

For more information about Maven, see the Apache Maven Project website.

Declaring Java dependencies by using Maven

When developers create a Maven build script, they can refer to dependencies that are supplied by IBM Semeru Runtime Certified Edition.
Prerequisites
Before you develop Java applications for JZOS by using Maven, ensure that the following items are true:
  • Maven is installed on your workstation or IDE.
  • You either created a Maven module to include your application, or you converted an existing Java project to a Maven module. Most Java IDEs support this function.

How to declare dependencies

Dependencies are declared in the Maven module's pom.xml file:
<dependencies>
    <dependency>
        <groupId>com.ibm.jzos</groupId>
        <artifactId>ibm.jzos</artifactId>
        <version>3.1.3.1</version>
        <scope>provided</scocpe>
    </dependency>
</dependencies>

All versions of the JZOS library are available on Maven Central with a group ID of com.ibm.jzos and an artifact ID of ibm.jzos

Different versions of IBM Semeru Runtime Certified Edition for z/OS contain different versions of the JZOS library. Ensure that your applications use the Maven artifact that corresponds to your target Java environment:

Artifact ID Version Description
ibmjzos 2.4.11.x IBM SDK, Java Technology Edition, version 8
ibm.jzos 3.1.3.x IBM Semeru Runtime Certified Edition, version 11 or later

The dependency for the ibm.jzos artifact can be specified <scope>provided</scope> so that the JZOS library is not included in the application’s runtime class path. The correct library is provided by the runtime when you run your applications with IBM Semeru Runtime Certified Edition for z/OS.

Important: Use the correct Maven scope for each referenced dependency. Correct scope can avoid runtime conflicts and reduce the size of the application.
Note: The snippets that are shown on Maven Central are auto-generated and might not show the correct Maven directives such as <scope>import</scope>. Follow the syntax in this topic to make sure that the dependencies are correctly declared. More recent versions might be available, so check Maven Central for all available versions.

JZOS Maven Jar release versions

The following table indicates the change log for various JZOS Maven Jar files.
Table 2. Change log - JZOS Maven Jar release versions for Java 21
Version number Description
3.1.3.1 Initial release of the JZOS Maven Jar file.
3.1.3.2 Javadoc generation issues that are encountered during usage of Visual Studio Code are resolved.
3.1.3.3

Standardized exception handling across all methods is implemented.

Dependency on ibm.os390 for all Java files is removed.

Next steps

Write an application by using the JZOS Java API

JZOS helps you to develop Java applications for z/OS that run in a traditional batch environment, or that access z/OS system services. For more information, see IBM JZOS batch launcher user's guide or IBM JZOS toolkit user's guide.

For API documentation, see the API reference guide.

Try some samples

JZOS provides a set of instructions for developers to use while they get started. For more information, see Installing the JZOS batch launcher.

Sample Java programs that use the JZOS library are available to download: JZOS Samples.

Build and deploy an application

As a developer, you can build an application and integrate it into your build toolchain in the same way that you build and deploy other Maven modules. For more information, see Introduction to the POM in the Maven documentation.