What is the right Maven dependency for javax.jms.* classes? What is the right Maven dependency for javax.jms.* classes? java java

What is the right Maven dependency for javax.jms.* classes?


In ActiveMQ as well as some other projects like Qpid JMS we pull in the JMS spec classes from Apache Geronimo JARs, the 1.1 APIs are available in this dependency:

  <dependency>    <groupId>org.apache.geronimo.specs</groupId>    <artifactId>geronimo-jms_1.1_spec</artifactId>    <version>1.1.1</version>  </dependency>

For JMS 2 APIs you'd need to use a different dependency, for instance

  <dependency>    <groupId>org.apache.geronimo.specs</groupId>    <artifactId>geronimo-jms_2.0_spec</artifactId>    <version>1.0-alpha-2</version>  </dependency>

These are both Apache 2.0 licensed dependencies.

Another option which is not Apache licensed is here as others have pointed out.

<dependency>    <groupId>javax.jms</groupId>    <artifactId>javax.jms-api</artifactId>    <version>2.0.1</version></dependency>


The Sun license doesn't allow maven repositories to host this (and other) artifacts.

Here is the documentation explaining this and what you should do instead...

Maven - Guide to coping with Sun JARs

What it says is you need to download the JAR manually and then install it into your own local repository or nexus server.

The pom.xml files hosted at maven central for these artifacts contain information on where you can download the JARs from.


   <dependency>      <groupId>javax</groupId>      <artifactId>javaee-api</artifactId>      <version>6.0</version>      <scope>provided</scope>    </dependency>