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

JavaMavenJms

Java Problem Overview


I need to import javax.jms.* classes. What is the right dependency to include into a Maven project? I'm trying javax.jms:jms:1.1, but no luck (it's pom, not jar).

ps. The only workaround I've found so far is: javax:javaee-api:6.0 (from Maven Central).

Java Solutions


Solution 1 - Java

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>

Solution 2 - Java

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.

Solution 3 - Java

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

Solution 4 - Java

I have successfully used this one:

<dependency>
  	<groupId>javax.jms</groupId>
   	<artifactId>jms</artifactId>
   	<version>1.1</version>
</dependency>

Solution 5 - Java

Go to Maven Search site and search for javax. Open the latest version for groupId javax and artifactId javaee-api

The current version is 7.0 [Maven dependency information]

Solution 6 - Java

If you just want the JMS libs, without the rest of javaee, use the following:

https://mvnrepository.com/artifact/javax.jms/javax.jms-api/2.0.1

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

Solution 7 - Java

According to mvnrepository, the dependency to add in the pom of your project is the following:

<dependency>
  <groupId>jms</groupId>
  <artifactId>jms</artifactId>
  <version>1.1</version>
</dependency>

Solution 8 - Java

Check out the dependencies listed on grepcode.com.
I only discovered this site recently, and it rocks!

http://grepcode.com/search/?query=javax.jms.*

It looks like the Geronimo jars on maven central should sort your issues out.

Solution 9 - Java

This worked for myself

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionyegor256View Question on Stackoverflow
Solution 1 - JavaTim BishView Answer on Stackoverflow
Solution 2 - JavaJesse WebbView Answer on Stackoverflow
Solution 3 - JavaawarenessView Answer on Stackoverflow
Solution 4 - JavaBozhoView Answer on Stackoverflow
Solution 5 - JavaramView Answer on Stackoverflow
Solution 6 - JavajaseView Answer on Stackoverflow
Solution 7 - JavatalnicolasView Answer on Stackoverflow
Solution 8 - JavacrowneView Answer on Stackoverflow
Solution 9 - JavaC McShaneView Answer on Stackoverflow