Using the Websphere Liberty Profile Maven repo with Gradle

This is obviously not a biggy, so mainly a short reminder for myself.

For the current development we’re using the Websphere Liberty Profile (WLP) a lot. Based on our latest efforts of moving everything to Gradle I ran into the situation to setup the WLP repos for that.

IBM has described here how to add the WLP libraries to a local Maven repo.

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

As you can see they are referring to the most current version using the LATEST value in the version tag. This doesn’t work well with Gradle. To make it running with Gradle (we’re using a compile group) you’ve to specify the real version number. In this case it’s ‘8.5.x.2’ (see the maven-metadata file here).

The working build.gradle file now looks like this.

repositories {
   maven {
      url "http://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/"
   }
}

dependencies {
    compile group: 'com.ibm.tools.target', name: 'was-liberty', version:'8.5.x.2'
}

Btw: we’re using Nexus Sonatype for our repo handling, where we’ve added the above mentioned IBM Maven repo as a remote proxy repo. Highly recommended.