[英]External Jars in to spring boot application deployed in heroku
This question may seems duplicate but I tried all the options but no luck. 这个问题似乎很重复,但是我尝试了所有选项,但没有运气。
I want to add a external jar which is not there in maven repository in to my spring boot bulk jar. 我想在我的Spring Boot批量jar中添加一个不在Maven存储库中的外部jar。 This application is deployed in the heroku cloud and is ran using the command
此应用程序已部署在heroku云中,并使用以下命令运行
java -Dserver.port=$PORT -jar target/myjar.jar
I tried various scenarios to fix this 我尝试了各种方案来解决此问题
1. 1。
<dependency>
<groupId>exjar</groupId>
<artifactId>exjar</artifactId>
<scope>system</scope>
<version>JDK7</version>
<systemPath>${project.basedir}/lib/exjar-JDK7.jar</systemPath>
</dependency>
2. 2。
java -Dserver.port=$PORT -Dloader.path="lib/*" -jar target/myjar.jar
3. maven-install-plugin 3. maven-install-plugin
None of the above worked. 以上都不起作用。 I want to try below approach, any idea of how to execute this command in heroku?
我想尝试以下方法,如何在heroku中执行此命令?
mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging>
-DgeneratePom=true
Any solution is appreciated. 任何解决方案表示赞赏。
Add following repository in you pom 在pom中添加以下存储库
<repositories>
<repository>
<id>external</id>
<name>External Project Repo</name>
<url>file:///${project.basedir}/lib</url>
</repository>
</repositories>
then add the dependency 然后添加依赖项
<dependency>
<groupId>exjar</groupId>
<artifactId>exjar</artifactId>
<version>jdk7</version>
</dependency>
When you finished building your myjar.jar should have BOOT-INF/lib/exjar-jdk7.jar
完成构建myjar.jar时,应具有
BOOT-INF/lib/exjar-jdk7.jar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.