spring boot Maven 插件 build-image 不起作用

Vin*_*nay 5 buildpack docker spring-boot

我使用 spring boot 版本 3.0.1 和 java 版本 17 从 start.spring.io 创建了演示项目。

我尝试在终端上执行以下命令来构建 Docker 映像

mvn spring-boot:build-image -Dspring-boot.build-image.imageName=testtesttest

结果出现了错误

[INFO]     [creator]         $BPL_JVM_THREAD_COUNT        250                                                          the number of threads in memory calculation
[INFO]     [creator]         $JAVA_TOOL_OPTIONS                                                                        the JVM launch flags
[INFO]     [creator]         Using Java version 18 extracted from MANIFEST.MF
[INFO]     [creator]       No valid JRE available, providing matching JDK instead. Using a JDK at runtime has security implications.
[INFO]     [creator]        : Contributing to layer
[INFO]     [creator]       Warning: Dependency has no SHA256. Skipping cache.
[INFO]     [creator]         Downloading from 
[INFO]     [creator]     unable to invoke layer creator
[INFO]     [creator]     unable to get dependency 
[INFO]     [creator]     unable to download 
[INFO]     [creator]     unable to request 
[INFO]     [creator]     Get "": unsupported protocol scheme ""
[INFO]     [creator]     ERROR: failed to build: exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  14.756 s
[INFO] Finished at: 2023-01-02T15:18:19+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:build-image (default-cli) on project demo: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:build-image failed: Builder lifecycle 'creator' failed with status code 51 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Run Code Online (Sandbox Code Playgroud)

我在 Mac 上使用 openjdk(版本“18.0.2”2022-07-19)。无法弄清楚。你能帮忙吗?

Vin*_*nay 1

看起来默认的映像生成器尚不支持 Mac M1 处理器。我必须在 pom.xml 中添加 Maven 插件的替代构建器,如下所示:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <image>
            <builder>dashaun/builder:tiny</builder>
        </image>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)