JHipster - Java 构建与基础镜像不兼容 - jib

问题描述 投票:0回答:2

我运行 JHaspter 应用程序的 Docker 镜像构建命令

./mvnw package -Pprod verify jib:build
这会产生错误:

Your project is using Java 17 but the base image is for Java 11, perhaps you should configure a Java 17-compatible base image using the '<from><image>' parameter, or set maven-compiler-plugin's '<target>' or '<release>' version to 11 or below in your build configuration
我找到了

Gradle 的解决方案。如何对 Maven 进行相同的修复?

jhipster jib
2个回答
0
投票
您可以使用pom.xml上的属性

<jib-maven-plugin.image>eclipse-temurin:17-jre-focal</jib-maven-plugin.image>

指定使用的图像,它应该定义为

<from> <image>${jib-maven-plugin.image}</image> <platforms> <platform> <architecture>${jib-maven-plugin.architecture}</architecture> <os>linux</os> </platform> </platforms> </from>
在 jib-maven-plugin 构建定义中,以及 pom.xml 上。


0
投票
try this <plugin> <groupId>com.google.cloud.tools</groupId> <artifactId>jib-maven-plugin</artifactId> <version>2.8.0</version> <configuration> <from><image>corresponding java image</image> <auth> <username>docker user name </username> <password>docker password </password> </auth> </from> <to> <image>username/${project.artifactId}:version</image> </to> </configuration> </plugin> check this link for reference: https://www.baeldung.com/jib-dockerizing
    
© www.soinside.com 2019 - 2024. All rights reserved.