32

I just created a new Maven project using the default archetype and added the following dependency to my POM file.

<dependencies>
  <dependency>
    <groupId>javax.jms</groupId>
    <artifactId>jms</artifactId>
    <version>1.1</version>
    <scope>compile</scope>
  </dependency>
</dependencies>

Realizing that the Sun's JARs are not on Maven central due to licensing issues, I added the following Maven repo to my POM (I know this is bad practice though and that it needs to be added to a settings.xml)

<repositories>
  <repository>
    <id>Repo ID</id>
    <layout>default</layout>
    <name>Java.net Maven repo</name> 
    <releases>
      <enabled>true</enabled>
    </releases>
    <url>http://download.java.net/maven/2/</url>
  </repository>
</repositories>

I still see this error in my POM file.

"Missing artifact javax.jms:jms:jar:1.1:compile"

Does anyone here know what else needs to be done in addition to the config I already have?

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
Phanindra
  • 363
  • 1
  • 4
  • 9

3 Answers3

45

Realizing that the Sun's JARs are not on Maven central due to licensing issues, I added the following Maven repo to my POM

Yeah, but http://download.java.net/maven/2/javax/ doesn't have the jms artifact...

The good news is that the JBoss Nexus repository does have it:

<repository>
  <id>repository.jboss.org-public</id>
  <name>JBoss repository</name>
  <url>https://repository.jboss.org/nexus/content/groups/public</url>
</repository>
Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • Do you know if any has source and javadoc jars/poms for JMS? Apparently JBoss only has the binary JAR. – Dave Dec 07 '10 at 22:38
  • 1
    If you get the message "No connector available to access repository java.net" after adding the repo the problem is that you are using Maven3, which is not compatible with Maven2 repos. You can either downgrade or add exceptions: http://stackoverflow.com/questions/7894794/maven-failing-to-resolve-recursive-dependencies-with-multiple-repositories – ceiroa Sep 04 '12 at 20:51
6

If you just want the jms artifact and don't want to add the whole repo, you can do the following:

wget https://repository.jboss.org/nexus/content/groups/public/javax/jms/jms/1.1/jms-1.1.jar
mvn -e install:install-file -Dfile=./jms-1.1.jar -DartifactId=jms -DgroupId=javax.jms -Dversion=1.1 -Dpackaging=jar
Florian
  • 3,069
  • 1
  • 26
  • 26
  • Thank you. Actually this solution solved the problem for me. I was trying to build Spring RCP 1.1.0 and it failed with the above error. Your solution nailed it. Thanks +1 – SkyWalker May 06 '13 at 15:16
  • You'd better install a custom Maven repository, if you are in a bigger organization, so that your build is reproducible also outside of your local machine. – OndroMih Dec 08 '16 at 10:15
6

In fact the real solution for this issue is to use the jms-api-1.1-rev-1.jar artifact available on Maven Central : http://search.maven.org/#artifactdetails%7Cjavax.jms%7Cjms-api%7C1.1-rev-1%7Cjar

Sébastien Deleuze
  • 5,950
  • 5
  • 37
  • 38
  • There's and artifact even for JMS-API 2.0: http://search.maven.org/#artifactdetails%7Cjavax.jms%7Cjavax.jms-api%7C2.0.1%7Cjar – OndroMih Dec 08 '16 at 10:14