如何在Bitbucket上设置基于Java 11的Spring Boot管道?

时间:2019-04-19 09:36:26

标签: maven spring-boot bitbucket pipeline

构建失败,并显示“无效目标版本:11”消息。

提交到bitbucket后,管道作业会自动启动,但失败,

完整错误消息: [错误]无法在项目sms上执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:compile(默认编译)-常见:致命错误编译:无效目标版本: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

我希望构建成功,但是在我写构建作业时失败了。

2 个答案:

答案 0 :(得分:1)

您需要使用更新版本的maven编译器插件

    org.apache.maven.plugins     Maven编译器插件     3.8.0

您需要一个提供java 11的maven Docker映像,例如maven:3-jdk-11

答案 1 :(得分:1)

我使用: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