Configuring dependency POM files that emulate the classpath of specific WebSphere runtime environments

You can use target Project Object Model (POM) files as Maven dependencies. These dependencies emulate the classpath of WebSphere runtime environments to compile your Java EE and OSGi application.

About this task

You must configure a target POM file differently depending on the version of WebSphere Application Server Liberty or traditional that you are using.

Important: Applicable to Liberty, WebSphere® Application Server traditional

Procedure

  • For WebSphere Application Server Liberty V8.5.5.8 and later, complete the following steps:
    1. Choose the applicable version of one of the following snippets of Maven dependencies.

      The following snippets are part of the ci.maven.tools GitHub repository from Maven Central.

      liberty-target

      This dependency aggregates all of the WebSphere Application Server Liberty API, SPI, recommended Java specification dependencies, and third-party implementation dependencies.

      <dependency>
            <groupId>net.wasdev.maven.tools.targets</groupId>
            <artifactId>liberty-target</artifactId>
            <version>RELEASE</version>
            <type>pom</type>
            <scope>provided</scope>
      </dependency>
      liberty-apis

      This dependency includes WebSphere Application Server Liberty API dependencies. This dependency satisfies all API libraries in the dev/api/ibm/ directory of a Liberty installation.

      <dependency>
            <groupId>net.wasdev.maven.tools.targets</groupId>
            <artifactId>liberty-apis</artifactId>
            <version>RELEASE</version>
            <type>pom</type>
            <scope>provided</scope>
      </dependency>
      liberty-spis

      This dependency includes WebSphere Application Server Liberty SPI dependencies. This dependency satisfies all SPI libraries in the dev/spi/ibm/ directory of a Liberty installation.

      <dependency>
            <groupId>net.wasdev.maven.tools.targets</groupId>
            <artifactId>liberty-spis</artifactId>
            <version>RELEASE</version>
            <type>pom</type>
            <scope>provided</scope>
      </dependency>
      java-specs

      This dependency includes Java specification dependencies. This dependency can satisfy all recommended Java specification libraries in the dev/api/ibm/ and dev/spi/ibm/ directories of a Liberty installation.

      <dependency>
            <groupId>net.wasdev.maven.tools.targets</groupId>
            <artifactId>java-specs</artifactId>
            <version>RELEASE</version>
            <type>pom</type>
            <scope>provided</scope>
      </dependency>
      third-party

      This dependency includes third-party implementation dependencies. This dependency can satisfy third-party libraries in the dev/api/third-party and dev/spi/third-party directories of a Liberty installation.

      <dependency>
            <groupId>net.wasdev.maven.tools.targets</groupId>
            <artifactId>third-party</artifactId>
            <version>RELEASE</version>
            <type>pom</type>
            <scope>provided</scope>
      </dependency>
    2. Change the RELEASE variable to your version of WebSphere Application Server Liberty.

      For example, you can change RELEASE to 8.5.5.9 for WebSphere Application Server Liberty V8.5.5.9.

      Tip: If you do not edit the RELEASE value, then the tools use the latest available version by default.
    3. Use these snippets to specify the server runtime environment APIs to compile Java EE and OSGi applications.
  • For WebSphere Application Server Liberty V8.5.5.4, V8.5.5.5, V8.5.5.6, or V8.5.5.7, complete the following steps:
    1. Configure the IBM Maven repository as a Maven remote repository to indicate the dependency that emulates the classpath of your runtime environment.

      For more information about configuring the IBM Maven repository, see Setting up the IBM Maven repository.

    2. Choose the applicable version of one of the following dependencies.
      was-liberty

      This dependency satisfies all of the WebSphere Application Server Liberty APIs, SPIs, and recommended Java specification dependencies.

      <dependency>
            <groupId>com.ibm.tools.target</groupId>
            <artifactId>was-liberty</artifactId>
            <version>RELEASE</version>
            <type>pom</type>
            <scope>provided</scope>
      </dependency>
      was-liberty-impl

      This dependency contains third-party implementation libraries such as Open JPA, Wind, and Jackson.

      <dependency>
            <groupId>com.ibm.tools.target</groupId>
            <artifactId>was-liberty-impl</artifactId>
            <version>RELEASE</version>
            <type>pom</type>
            <scope>provided</scope>
      </dependency>
    3. Change the RELEASE variable to the Maven dependency version that corresponds to your version of WebSphere Application Server Liberty.

      You can use the following chart to determine which Maven dependency version corresponds to your version of WebSphere Application Server Liberty:

      WebSphere Application Server Liberty version Maven dependency version
      8.5.5.9 8.5.x.6 or RELEASE
      8.5.5.8 8.5.x.5
      8.5.5.7 8.5.x.4
      8.5.5.6 8.5.x.3
      8.5.5.5 8.5.x.2
      8.5.5.4 8.5.x.1

      For example, you can change RELEASE to 8.5.x.2 for WebSphere Application Server Liberty V8.5.5.5.

      Tip: If you do not edit the RELEASE value, then the tools use the latest available version by default.
  • For WebSphere Application Server traditional, see Installing the server APIs into the Maven repository.