Developing IBM MQ Clients With Java and Maven

Creating an MQ Client in Java to talk to other systems via MQ queues is relatively easy to setup once you get to learn the basics. If you are using maven to grab your dependencies it should be easy there too.

But one problem with IBM MQ has long been that if you are using maven to manage the dependencies and build for your project, the relevant jars were not available in the central maven repositories. You had to get them either from IBM or from your middleware team if you were in a large organisation, then add the jars to your local or internal repository manually to make it accessible.

IBM MQ Client Is Now Available In The Maven Repo

But as of last year, IBM has started adding their allclient jars to the maven repo. This makes it much simpler to integrate the MQ client code into your application. To be honest adding the MQ client jars to your repository wasnt that big a deal once you figured our the commands needed to run, but the fact that its now in the Maven Repository just gives you one less thing to worry about. Adding the latest allclient jar to your project then should be as simple as adding the dependency shown below to your projects POM and rebuilding to trigger the update of your repository.

How To Add The IBM MQ Client To Your Maven Repo Manually

For completeness, im going to tell you how to add the IBM MQ Client jars into your repo. This would be relevant if you are looking to use old versions of the jars, as only the version from last year (2018) on will be added. You shouldnt really need to use the old version unless you are stuck on legacy versions of java in your environment, as the latest version should always be backward compatible. Generally you will find that IBM tends to make their software backward compatible so that it never breaks existing code

Get The IBM MQ Client Jars

So the first steps to adding the MQ client into your maven repo is to get the client jars. For example the latest jars available in the maven repo is for version

ibm mq allclient maven repo

If for example you couldnt access the maven repo directly for some reason but needed to add those jars in, you could download the jars directly from the maven repo, and add them into your local repo using the command below.

Add The Jars Into Maven Manually

Using the example of the latest version of the IBM MQ Allclient jars as shown above, the command below would be what you would run to add them into your repo manually. Assuming you had downloaded the jars to c:\dev\jars\ and the artifact looked like this

Then you would run this command to add the jars

mvn install:install-file -Dfile=c:\dev\jars\ -Dversion= -Dpackaging=jar

Leave a Comment

Your email address will not be published. Required fields are marked *