Building JMS Projects with Maven
Apache Maven is a software management tool that can be used to build, install, and distribute Java-based projects. With Apache Maven, you can:
- obtain Solace Messaging API for JMS artifacts from Maven Central
- install Solace JMS API artifacts in a local corporate Maven repository
- deploy Solace JMS API artifacts to remote repositories
To build a project with Maven, the Solace JMS API requires the following artifacts:
- sol-jms-10.x.x.jar—the Solace JMS API libraries
- sol-jcsmp-10.x.x.jar—the Solace JCSMP API libraries
- solsuite-10.x.x.pom—Solace Messaging API project configuration file
- sol-common-10.x.x.jar—Solace Java API utilities
To use the Solace JMS API with Maven, you can:
- obtain Solace JMS API artifacts from Maven Central
- install Solace JMS API artifacts in a local corporate Maven repository
- deploy Solace JMS API artifacts to remote repositories
Obtaining Artifacts from Maven Central
To obtain the required Solace JMS API artifacts for your project from the Maven Central Repository, you must declare the following dependency in your pom.xml file:
<dependency>
<groupId>com.solacesystems</groupId>
<artifactId>sol-jms</artifactId>
<version>10.29.x</version>
</dependency>
Using JMS 1.1 with the Solace JMS API
Some applications may need to continue to use the Geronimo 1.1 Spec if they have components that are dependent on version 1.1 of the JMS Specification. For versions 10.20 and later of the Solace JMS API, you need to use a compatibility layer to allow backwards compatibility with applications that have Geronimo JMS 1.1 dependencies (geronimo-jms_1.1_spec). You also need to exclude the Geronimo JMS 2.0 specifications to avoid conflicts. To achieve this, add the following to your pom.xml file:
<dependency>
<groupId>com.solacesystems</groupId>
<artifactId>sol-jms</artifactId>
<version>10.20.x</version>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_2.0_spec</artifactId>
</exclusion>
</dependency>
<dependency>
<groupId>com.solacesystems</groupId>
<artifactId>sol-jms-compat-1.1</artifactId>
<version>1.0.0</version>
</dependency>
Installing Artifacts Locally
To use Solace JMS API artifacts as Maven dependencies, you must install the Solace JMS API jar files and pom.xml files into your local repository.
To install a jar or a pom.xml file locally, enter the following command in a terminal window:
mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile> -Dmaven.repo.local=<path-to-local-repository>
Example of installing a .jar:
$ mvn install:install-file
-Dfile=/downloads/sol-jms/lib/sol-jms-10.x.x.jar
-DpomFile=/downloads/sol-jms/lib/sol-jms-10.x.x.pom
-Dmaven.repo.local=./.repository
$ ls /tmp/.repository/com/solace/sol-jms/10.x.x/
_remote.repositories sol-jms-10.x.x.jar sol-jms-10.x.x.pom
Example of installing a pom.xml file:
$ mvn install:install-file -Dfile=/downloads/sol-jms/lib/solsuite-10.x.x.pom -DpomFile=/downloads/sol-jms/lib/solsuite-10.x.x.pom -Dmaven.repo.local=./.repository
Using JCA Resource Adapters
For Jakarta EE application server environments (such as WildFly 27+ or JBoss EAP 8+), use the Jakarta-based JCA Resource Adapter instead of the legacy javax.*-based adapter.
To include the Jakarta resource adapter in your Maven project, add the following dependency to your pom.xml file:
<dependency>
<groupId>com.solacesystems</groupId>
<artifactId>sol-jms-jakarta-ra</artifactId>
<version>10.30.0</version>
</dependency>
For detailed information about the Jakarta resource adapter, including supported application servers and configuration examples, see Solace JCA Resource Adapter for Jakarta Messaging Overview.
Choosing Between javax and Jakarta Resource Adapters
Select the appropriate resource adapter based on your application server:
| Use This Resource Adapter | For These Application Servers |
|---|---|
|
Solace JCA Resource Adapter for JMS ( |
Legacy Java EE servers:
|
|
Solace JCA Resource Adapter for Jakarta Messaging ( |
Modern Jakarta EE servers:
|
The two resource adapter variants provide equivalent functionality but are binary-incompatible due to namespace differences. Do not attempt to use the javax.*-based adapter on Jakarta EE servers or vice versa.
Deploying Artifacts to Remote Repositories
To use Solace JMS API artifacts as Maven dependencies, you must deploy the jar and pom.xml files to a remote Maven repository for your project.
To deploy a jar or a pom.xml file to a Maven remote repository, enter the following command in a terminal window:
mvn deploy:deploy-file
-Dfile=<path-to-file>
-DpomFile=<path-to-pomfile>
-DrepositoryId=release
-Durl=<repository-url>