【问题标题】:How to make openshift take the right artifact in maven build如何让 openshift 在 Maven 构建中使用正确的工件
【发布时间】:2019-03-03 00:02:55
【问题描述】:

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

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

它构建并且没有错误。

但是!我面临的问题是我们在 Maven 插件中使用“exec”分类器进行 spring boot。这会在目标文件夹中生成两个 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>

【问题讨论】:

    标签: maven spring-boot openshift


    【解决方案1】:

    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
    

    【讨论】:

      猜你喜欢
      • 2018-06-16
      • 1970-01-01
      • 1970-01-01
      • 2021-06-02
      • 1970-01-01
      • 2020-10-28
      • 1970-01-01
      • 2016-11-26
      • 2017-03-14
      相关资源
      最近更新 更多