Java application development using a Maven repository

When developing a Java application for IBM® MQ, by using a Maven repository to automatically install dependencies, you do not need to explicitly install anything before using IBM MQ interfaces.

Maven Central Repository

Maven is a tool for building applications and also provides a repository for holding artifacts that your application may want to access.

The Maven Repository (or Central Repository) has a structure that allows files such as JAR files to have distinct versions that are then easily discovered with a well-known naming mechanism. Build tools can then use those names to dynamically pull in the dependencies for your application. In the definition of your application, which, when using Maven as a build tool, is called the POM file, you name the dependencies and the build process knows what to do from there.

IBM MQ client files

Copies of the IBM MQ Java client interfaces are available in the Central Repository under the com.ibm.mq GroupId. You can find the com.ibm.mq.jakarta.client.jar file (Jakarta Messaging 3.0) and the com.ibm.mq.allclient.jar file (JMS 2.0). These files are typically used for standalone programs. You can also find the wmq.jakarta.jmsra.rar file (Jakarta Messaging 3.0) and the wmq.jmsra.rar file (JMS 2.0), which is for use in Java EE application servers). The jakarta.client.jar and the allclient.jar both contain the IBM MQ classes for JMS and the IBM MQ classes for Java.
Important: Using the Apache Maven Assembly Plugin jar-with-dependencies format to build an application which includes the IBM MQ relocatable JAR file is not supported.
In a pom.xml file processed by the maven command, you add dependencies for these JAR files as shown in the following examples:
  • [Jakarta Messaging 3.0]To show the relationship between your application code and com.ibm.mq.jakarta.client.jar:
    <dependency>
            <groupId>com.ibm.mq</groupId>
            <artifactId>com.ibm.mq.jakarta.client</artifactId>
            <version>9.3.0.0</version>
        </dependency>
  • [JMS 2.0]To show the relationship between your application code and com.ibm.mq.allclient.jar:
    <dependency>
            <groupId>com.ibm.mq</groupId>
            <artifactId>com.ibm.mq.allclient</artifactId>
            <version>9.2.2.0</version>
        </dependency>
  • [Jakarta Messaging 3.0]For using the Jakarta EE resource adapter:
    <dependency>
         <groupId>com.ibm.mq</groupId>
         <artifactId>wmq.jakarta.jmsra</artifactId>
         <version>9.3.0.0</version>
     </dependency>
  • [JMS 2.0]For using the JMS 2.0 Java EE resource adapter:
    <dependency>
         <groupId>com.ibm.mq</groupId>
         <artifactId>wmq.jmsra</artifactId>
         <version>9.2.2.0</version>
     </dependency>

For an example of a simple project in Eclipse to run a JMS project, see the IBM Developer article Developing Java applications for MQ just got easier with Maven.