java.net maven repo - JMS artifact missing

2020-05-19 22:46发布

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?

3条回答
Melony?
2楼-- · 2020-05-19 23:19

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
查看更多
够拽才男人
3楼-- · 2020-05-19 23:35

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

查看更多
爷的心禁止访问
4楼-- · 2020-05-19 23:38

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>
查看更多
登录 后发表回答