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

[8.5.5.2 or later]If you plan to use target Project Object Model (POM) files that emulate the classpath of WebSphere runtime environments, you can configure your maven project dependencies and perform the steps required to use those dependencies.

About this task

Important: Applicable to Liberty, WebSphere® Application Server traditional

[8.5.5.2 or later]Target POM files are available that represent the server runtime environment for compilation purposes. Target POM files are available for the following runtimes, and you can add a corresponding fragment as a dependency:

[8.5.5.2 or later]
  • WebSphere Application Server Version 8.5.5
    <dependency>
          <groupId>com.ibm.tools.target</groupId>
          <artifactId>was</artifactId>
          <version>8.5.5</version>
          <type>pom</type>
          <scope>provided</scope>
    </dependency>
  • WebSphere Application Server Version 8.5.0.2
    <dependency>
          <groupId>com.ibm.tools.target</groupId>
          <artifactId>was</artifactId>
          <version>8.5.0</version>
          <type>pom</type>
          <scope>provided</scope>
    </dependency>
  • [8.5.5.4 or later][Liberty] WebSphere Application Server Liberty Version 8.5.x (Includes all 8.5 maintenance releases)
    <dependency>
          <groupId>com.ibm.tools.target</groupId>
          <artifactId>was-liberty</artifactId>
          <version>LATEST</version>
          <type>pom</type>
          <scope>provided</scope>
    </dependency>
  • [8.5.5.4 or later][Liberty] Optional dependency for compilation against 3rd party implementation libraries, such as Open JPA, Wink, and Jackson
    <dependency>
          <groupId>com.ibm.tools.target</groupId>
          <artifactId>was-liberty-impl</artifactId>
          <version>LATEST</version>
          <type>pom</type>
          <scope>provided</scope>
    </dependency>
  • WebSphere Portal Version 8.0
    <dependency>
          <groupId>com.ibm.tools.target</groupId>
          <artifactId>portal</artifactId>
          <version>8.0.0</version>
          <type>pom</type>
          <scope>provided</scope>
    </dependency>

[8.5.5.2 or later]The dependencies for WebSphere Application Server Liberty Version 8.5.x target POM do not require any further configuration. For all remaining POM targets, you are required to use launch configuration scripts that copy runtime libraries to the local Maven repository.

The scripts are in the com.ibm.etools.maven.javaee.core plug-in, which is located under the plugins directory in the product installation.

Procedure

  1. To import the launch configuration script for the target runtime environment, click File > Import > Run/Debug > Launch Configurations.
  2. Click Browse to locate the directory where the scripts are, and then select them.
    • For WebSphere Application Server, the scripts are located in: <IBMSharedFolder>\plugins\com.ibm.etools.maven.javaee.core_x\resources\RunConfigurations\WAS855PluginsInstaller.launch
      Note: This script can also be used for WebSphere Application Server V8.5.0.2
    • For WebSphere Portal V8.0: <IBMSharedFolder>\plugins\com.ibm.etools.maven.javaee.core_x\resources\RunConfigurations\WAS8PluginsInstaller.launch
    Note: X in com.ibm.etools.maven.javaee.core_x is the version of the plug-in.
  3. Click Finish.
  4. To modify the launch configuration, click Run > Run configurations. Expand Maven Build to see the imported configuration, and then click the launch configuration to open it.
  5. In the Base directory field, specify the location where the pom.xml can be found:
    • WebSphere Application Server V8.5.5: <IBMSharedFolder>\plugins\com.ibm.etools.maven.javaee.core\resources\scripts\WAS 8.5.5 Plugins Installer
    • WebSphere Application Server V8.5.0.2: <IBMSharedFolder>\plugins\com.ibm.etools.maven.javaee.core\resources\scripts\WAS 8.5.0 Plugins Installer
    • WebSphere Portal V8.0: <IBMSharedFolder>\plugins\com.ibm.etools.maven.javaee.core\resources\scripts\WAS 8 Plugins Installer
  6. Specify a value for the serverInstallationFolder parameter.
    1. Select the parameter and click Edit.
    2. In the Value field, specify the directory where the server is installed and then click OK:
      • WebSphere Application Server: <server_installation_directory>\AppServer
  7. Click Run to run the launch configuration.
  8. Open the Maven Repositories view by clicking Window > Show View > Other > Maven > Maven repositories.
  9. In the Maven repositories view, expand Local Repositories. Right click the node Local Repository (C:\Users..\.m2\repository) and select Rebuild Index.
  10. Expand the node Local Repository (C:\Users..\.m2\repository) and verify the applicable jar file. In this case, com.ibm.websphere.j2ee.j2ee.1.0.0 is listed. Your local repository should look like this:
          Local Repositories                                        
          > Local repository (C:\Users\......\.m2\repository)      
            > com\                                                  
              > ibm\                                                
                > websphere\                                        
                  > j2ee\                                          
                    (jar icon) j2ee - jar              
                    > [M] j2ee : x.y.z                              
                                                         
  11. Optional: To verify that the jar files were installed correctly, create the project using the archetype com.ibm.tools.archetype.webapp.jee6-was. For more information, see Creating Maven projects.
  12. Optional: Check the contents of the Maven Dependencies classpath container of the project. In the Enterprise Explorer view, it looks like this:
       M(maven icon)J(java icon) project folder {YourProjectName}
          > (web project icon) {YourProjectName}                    
            > Java Resources                                        
              > src/main/java                                      
              > Libraries                                          
                > JRE System Library [JavaSE-1.6]                  
                > Maven Dependencies                                
                  - com.ibm.ws.wccm-1.0.0-jar - {respository path to jar}
                  - com.ibm.ws.emf-1.0.0-jar - {respository path to jar}
                  - j2ee-1.0.0-jar - {respository path to jar}
    		                

What to do next

Note: You can alternatively run the scripts from the Maven command line by specifying the command:mvn install -f <IBMSharedFolder>\plugins\com.ibm.etools.maven.javaee.core\resources\scripts\<plugin_installer_folder>\pom.xml" -DserverInstallationFolder="<server_installation_directory>"

[8.5.5.2 or later]For example: mvn install -f "<IBMSharedFolder>\plugins\com.ibm.etools.maven.javaee.core\resources\scripts\WAS 8.5.5 Plugins Installer\pom.xml" -DserverInstallationFolder="C:\Program Files\IBM\WebSphere\Appserver"

Icon that indicates the type of topic Task topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: localrepo.html