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 Solace JCSMP API.

Only versions 10.0.0 and later of the Solace JCSMP API are compatible with Apache Maven.

For the Solace JCSMP API, you can:

  • obtain the Solace JCSMP API artifacts from Maven Central
  • install Solace JCSMP API artifacts in a local corporate Maven repository
  • deploy Solace JCSMP API artifacts to remote repositories

To build a project with Maven that requires the Solace JCSMP API, the following artifacts are required:

  • solace-messaging-client-1.x.x.jar — the Solace JCSMP 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 API libraries
  • solsuite-10.x.x.pom — Solace Messaging API project configuration file
    • The solsuite pom is not required for versions 10.29 and later of the Solace JCSMP API.
  • sol-common-10.x.x.jar — Solace JCSMP API utilities

Starting with version 10.29.0, the solsuite pom file is no longer required. The sol-jcsmp artifact includes all necessary dependencies.

Obtaining Artifacts from Maven Central

To use Solace JCSMP API artifacts as Maven dependencies, you can install the .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 (only required for versions prior to 10.29.0):

$ 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 API artifacts as Maven dependencies, you can install the .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 (only required for versions prior to 10.29.0):

$ 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 API artifacts as Maven dependencies, you can deploy the .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>

Netty Dependency Compatibility

Versions 10.23 and later of the Solace JCSMP API rely on the Netty library as a dependency. The Solace JCSMP API has specific Netty version requirements:

  • Solace JCSMP API versions 10.29 and later require Netty 4.2.7.Final or later.
  • Solace JCSMP API versions 10.23 to 10.28 can use either Netty 4.1.x or Netty 4.2.x.
  • If using a Netty Bill of Materials (BOM), version 4.2.7.Final or later is required to ensure compatible Netty 4.2.x versions are used.
  • Using multiple Netty versions in a single project is not supported.

Solace JCSMP API versions 10.29 and later require Netty 4.2+, which is not supported by Spring Boot 3.x. Applications that use Spring Boot 3 should remain on versions 10.28 or earlier of the Solace JCSMP API.

For more information about Netty, see https://netty.io.

The following example shows a Maven dependency configuration for the Solace JCSMP API version 10.29.0 with the Netty 4.2.7.Final BOM:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-bom</artifactId>
            <version>4.2.7.Final</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>com.solace</groupId>
        <artifactId>sol-jcsmp</artifactId>
        <version>10.29.0</version>
    </dependency>
</dependencies>