我运行JHispter应用的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进行相同的修复?
您可以使用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插件构建定义中,也在pom.xml上。