【问题标题】:How to add external jar (proprietary) in Spring Boot?如何在 Spring Boot 中添加外部 jar(专有)?
【发布时间】:2016-08-02 23:41:42
【问题描述】:

我尝试在 pom.xml 中添加以下内容

<scope>system</scope>
<systemPath>${project.basedir}/lib/example-lib.jar</systemPath>

但没用。

我找到的更多信息:

可能与spring boot maven插件有关。 https://docs.spring.io/spring-boot/docs/current/maven-plugin/ 在构建 jar 时不包括范围“系统”库。

参考:https://github.com/spring-projects/spring-boot/blob/master/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LibraryScope.java

谢谢你。

【问题讨论】:

标签: maven spring-boot


【解决方案1】:

我建议您使用以下命令将文件安装到本地存储库。而不是使用系统路径(因为当有多个开发人员时很难管理路径(不同操作系统的复杂性更高))

mvn install:install-file -Dfile=<your jar file location\file name>.jar -DgroupId=com.kp<groupId> -DartifactId={your custom artifactId} -Dversion={version} -Dpackaging=jar

我使用上述方法来使用不属于 Maven Repo 的 oracle 的 ojdbc.jar。

【讨论】:

  • 这是链接重复问题所建议的方法,这个问题应该关闭,而不是回答
  • 那么你将如何部署一个包含外部 jar 的 jar?您是否只考虑本地?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-01-17
  • 1970-01-01
  • 2020-10-03
  • 2020-06-03
  • 2018-03-05
  • 1970-01-01
  • 2019-06-12
相关资源
最近更新 更多