Building Java Projects with Maven
Apache Maven is a software management tool that can be used to build, install, and distribute Java-based projects. You can build Java-based projects with the PubSub+ JCSMP API.
Only version 10.0.0 and later, isSolace JCSMP compatible with Apache Maven.
For the PubSub+ JCSMP API, you can:
- obtain the Solace JCSMP artifacts from Maven Central
- install Solace JCSMP artifacts in a local corporate Maven repository
- deploy Solace JCSMP artifacts to remote repositories
To build a project with Maven that requires the Java API, the following artifacts are required:
- solace-messaging-client-1.x.x.jar — the Solace Java messaging API libraries
- The JCSMP artifacts listed below.
To build a project with Maven that requires only JCSMP, the following artifacts are required:
- sol-jcsmp-10.x.x.jar — the Solace JCSMP messaging API libraries
- solsuite-10.x.x.pom — Solace API project configuration file
- sol-common-10.x.x.jar — Solace Java messaging API utilities
Obtaining Artifacts from Maven Central
To use Solace JCSMP artifacts as Maven dependencies, you can install the Solace .jar
and .pom
files into your local repository.
To install .jar
or .pom
file locally, enter the following command in a terminal window:
mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pom-file> -Dmaven.repo.local=<path-to-local-repository>
For example, to install a .jar
file for JCSMP:
$ mvn install:install-file
-Dfile=/downloads/sol-jcsmp/lib/sol-jcsmp-10.x.x.jar
-DpomFile=/downloads/sol-jcsmp/lib/sol-jcsmp-10.x.x.pom
-Dmaven.repo.local=./.repository
$ ls /tmp/.repository/com/solace/sol-jcsmp/10.x.x/
_remote.repositories sol-jcsmp-10.x.x.jar sol-jcsmp-10.x.x.pom
Example of installing a .pom
file for JCSMP:
$ mvn install:install-file -Dfile=/downloads/sol-jcsmp/lib/solsuite-10.x.x.pom -DpomFile=/downloads/sol-jcsmp/lib/solsuite-10.x.x.pom -Dmaven.repo.local=./.repository
Installing Artifacts Locally
To use Solace JCSMP artifacts as Maven dependencies, you can install the Solace .jar
and .pom
files into your local repository.
To install a .jar
or .pom
file locally, enter the following command in a terminal window:
mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pom-file> -Dmaven.repo.local=<path-to-local-repository>
For example, to install a .jar
file for JCSMP:
$ mvn install:install-file
-Dfile=/downloads/sol-jcsmp/lib/sol-jcsmp-10.x.x.jar
-DpomFile=/downloads/sol-jcsmp/lib/sol-jcsmp-10.x.x.pom
-Dmaven.repo.local=./.repository
$ ls /tmp/.repository/com/solace/sol-jcsmp/10.x.x/
_remote.repositories sol-jcsmp-10.x.x.jar sol-jcsmp-10.x.x.pom
Example of installing a .pom
file for JCSMP:
$ mvn install:install-file -Dfile=/downloads/sol-jcsmp/lib/solsuite-10.x.x.pom -DpomFile=/downloads/sol-jcsmp/lib/solsuite-10.x.x.pom -Dmaven.repo.local=./.repository
Deploying Artifacts to Remote Repositories
To use Solace JCSMP artifacts as Maven dependencies, you can deploy the Solace .jar
and .pom
files to a remote Maven remote repository for your project.
To deploy a .jar
or a .pom
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-pom-file>
-DrepositoryId=release
-Durl=<repository-url>