activemq-artemis/docs/user-manual/client-classpath.adoc

61 lines
2.5 KiB
Plaintext

= The Client Classpath
:idprefix:
:idseparator: -
== Maven dependencies
The recommended way to define a client dependency for your java application is through a Maven dependency declaration.
There are two dependencies you can choose from, `org.apache.activemq:artemis-jms-client` for JMS 2.0 or `org.apache.activemq:artemis-jakarta-client` for Jakarta Messaging 3.x.
For JMS:
[,xml,subs="normal"]
----
...
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-client</artifactId>
<version>{project-version}</version>
</dependency>
...
----
For Jakarta:
[,xml,subs="normal"]
----
...
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jakarta-client</artifactId>
<version>{project-version}</version>
</dependency>
...
----
== Individual client dependencies
If you don't wish to use a build tool such as Maven which manages the dependencies for you, you may also choose to add the specific dependency jars to your classpath, which are all included under ./lib on the main distribution.
For more information of the clients individual dependencies, see:
* xref:client-classpath-jms.adoc#artemis-jms-client-dependencies[JMS client dependencies]
* xref:client-classpath-jakarta.adoc#artemis-jakarta-client-dependencies[Jakarta client dependencies]
== Repackaged '-all' clients
Even though it is highly recommend to use the maven dependencies, in cases this isnt a possibility and neither is using the individual dependencies as detailed above then the all-inclusive repackaged jar could be used as an alternative.
These jars are available at Maven Central:
* https://repo.maven.apache.org/maven2/org/apache/activemq/artemis-jms-client-all/{project-version}/[artemis-jms-client-all-{project-version}.jar]
* https://repo.maven.apache.org/maven2/org/apache/activemq/artemis-jakarta-client-all/{project-version}/[artemis-jakarta-client-all-{project-version}.jar]
Whether you are using JMS or just the Core API simply add the `artemis-jms-client-all` jar to your client classpath.
For Jakarta Messaging add the `artemis-jakarta-client-all` jar instead.
WARNING: These repackaged jars include all the xref:client-classpath-jms.adoc#artemis-jms-client-dependencies[client's dependencies].
Be careful with mixing other components jars in your application as they may clash with each other.
Note also that the '-all' clients cant be embedded in the same JVM as the broker, for that you must use `artemis-jms-client` or `artemis-jakarta-client` as appropriate.