SpringBoot项目打包jar包报错:Failure to find javax.jms:jms:jar:1.1

郎家岭伯爵 2022年03月23日 488次浏览

背景

在做一个SpringBoot项目时,pom文件总是报错Cannot resolve javax.jms:jms:1.1。起初也没关注它,因为它对项目没有造成实际影响。

但是项目完结后,SpringBoot打jar包时报错:

Failure to find javax.jms:jms:jar:1.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

解决

pom文件中新增两个依赖

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

注:

  • 应注意第二个依赖并不在dependencies中新增,而是在repositories中新增。
<repositories>
  <repository>
     <id>repository.jboss.org-public</id>
     <name>JBoss.org Maven repository</name>
     <url>https://repository.jboss.org/nexus/content/groups/public</url>
     </repository>
</repositories>

总结

此解决方案参考自Stack Overflow

Stack Overflow中仍有其它的解决方案以及原因说明,大家如有兴趣可移步Stack Overflow。