如何使openshift在Maven构建中采用正确的工件

时间:2019-03-01 09:29:12

标签: maven spring-boot openshift

我正在尝试从openshift中的源代码构建Spring Boot应用程序。

oc new-app redhat-openjdk18-openshift~<git_repo_URL>

它可以构建并且没有错误。

但是!我面临的问题是我们在Maven插件中使用“ exec”分类器进行春季启动。这将在目标文件夹中产生两个jar文件。 “ app.jar”和“ app-exec.jar”。Openshift在构建中使用了app.jar而不是app-exec.jar,这导致该应用程序无法启动。

有没有办法告诉openshift使用哪个jar?

<plugin>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-maven-plugin</artifactId>
   <configuration>
       <classifier>exec</classifier>
   </configuration>
</plugin>

1 个答案:

答案 0 :(得分:0)

https://access.redhat.com/documentation/en-us/red_hat_jboss_middleware_for_openshift/3/html-single/red_hat_java_s2i_for_openshift/index#configuration_environment_variables看来,指定以下环境变量应该可以工作(无论是否带有.jar扩展名,我都不确定)

JAVA_APP_JAR=app-exec