如何在bitbucket上设置基于java 11的spring Boot 管道?

zphenhs4  于 2023-10-16  发布在  Spring
关注(0)|答案(4)|浏览(114)

生成失败,并显示“无效的目标版本:11”留言。
提交到bitbucket后,管道作业自动启动,但失败,

Full Error Message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project sms-commons: Fatal error compiling: invalid target release: 11 ->

如何支持Java 11?

image: maven:3.3.9

pipelines:
  default:
    - step:
        caches:
          - maven
        script: # Modify the commands below to build your repository.
          - mvn -B verify # -B batch mode makes Maven less verbose
          - mvn clean install

我期待一个成功的构建,但正如我所写的构建作业失败。

baubqpgj

baubqpgj1#

您需要使用更新版本的maven插件
org.apache.maven.plugins maven-compiler-plugin 3.8.0
您需要一个提供java 11的maven Docker镜像,例如maven:3-jdk-11

lf5gs5x2

lf5gs5x22#

我用途:ehsaniara/bitbucket-util作为Docker Image
举例说明:

options:
  docker: true
pipelines:
  branches:
    master:
      - step:
          name: Production Build on Master
          image: ehsaniara/bitbucket-util:latest
          trigger: automatic
          script:
            - mvn clean install
s6fujrry

s6fujrry3#

你需要maven image支持jdk 11,所以像下面这样更新你的“image”值:

image: maven:3.8.3-jdk-11

pipelines:
  default:
    - step:
        caches:
          - maven
        script: # Modify the commands below to build your repository.
          - mvn -B verify # -B batch mode makes Maven less verbose
          - mvn clean install
nwnhqdif

nwnhqdif4#

在docker中找到适合maven和jdk版本的maven镜像。另外选择你想要的JDK的发布者对于maven 3.9和JDK 17,我发现:maven:3.9-eclipse-temurin-17-alpine

相关问题