how to config gradle version in AWS codebuild image?

Viewed 471

This is my buildspec.yml:

phases:
  install:
    runtime-versions:
      java: corretto11

  pre_build:
    commands:
      - COMMIT_ID_SHORT=`echo "${CODEBUILD_RESOLVED_SOURCE_VERSION}" | cut -c1-8`
      - TAG=`echo "${MAJOR}.${MINOR}.${COMMIT_ID_SHORT}"`
      - aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin ${ECR_URL}
      - export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain cloud-infra-packages --domain-owner 715371302281 --query authorizationToken --output text`
  build:
    commands:
      - gradle clean build
      - docker build -t ${APP}:${TAG} -f Dockerfile
      - docker tag ${APP}:${TAG} ${ECR_URL}/${ECR_URL}:${TAG}

But I got a error message:

the gradle version is not supported, and I found the gradle version of codebuild standard image is 5.6.0, so how to modify the gradle version when build the project in AWS codebuild.

1 Answers

already fixed the problem, we should use ./graldew to build the project, not gralde.

Related