2

After the 7.0 Gradle version my pipeline is crashing. I want to downgrade it to 6.8.3. I tried with gradle wrapper --gradle-version=6.8.3 but its do nothing. Btw its a Microsoft-hosted agent with ubuntu-latest VM.

benadzs
  • 127
  • 2
  • 13

2 Answers2

1

I didn't find other solution, but it's work correctly.

- script: |
    wget https://downloads.gradle-dn.com/distributions/gradle-6.8.3-bin.zip
    unzip -d . gradle-6.8.3-bin.zip
  displayName: Download Gradle 6.8.3
- script: |
    ./../../gradle-6.8.3/bin/gradle bundleRelease
  displayName: Build Bundle
benadzs
  • 127
  • 2
  • 13
0

Please add distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip in your gradle/wrapper/gradle-wrapper.properties file.

For example:enter image description here

Here is the document.

Here is my configuration of pipeline and result:

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: Gradle@2
  inputs:
    gradleWrapperFile: 'gradlew'
    tasks: 'build'
    publishJUnitResults: false
    javaHomeOption: 'JDKVersion'
    jdkVersionOption: '1.8'
    gradleOptions: '-Xmx3072m'
    sonarQubeRunAnalysis: false

enter image description here

Walter
  • 2,640
  • 1
  • 5
  • 11
  • I created this file to the specificatied location. Maybe the gradle is preinstalled on the ubuntu-latest image, it can be posseble? I use only `gradle bundleRelease` to build a new aab. I need to do something to use the distributionUrl as the version? Is still 7.0. – benadzs Apr 21 '21 at 06:00
  • Yes, the default version of gradle is 7.0 on the ubuntu-latest image. According to [the document](https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/java?view=azure-devops#choose-the-version-of-gradle):The version of Gradle installed on the agent machine will be used unless your repository's gradle/wrapper/gradle-wrapper.properties file has a distributionUrl property that specifies a different Gradle version to download and use during the build. It works on my side. Can you share your configuration of pipeline? – Walter Apr 21 '21 at 06:06
  • Now it's clear what are you talking about. Now I stuck with `Error: Not found wrapperScript: gradlew`. I try to solve it. – benadzs Apr 21 '21 at 06:29
  • This error message means you do not have gradlew file in your repository. You can refer to [this document](https://docs.gradle.org/current/userguide/gradle_wrapper.html) and [this ticket](https://stackoverflow.com/questions/39627231/difference-between-using-gradlew-and-gradle). – Walter Apr 21 '21 at 06:54
  • I use ionic and the android platform files is not contains the gradlew file. I built with `ionic cordova prepare android`. I tried to generate with `gradle wrapper --gradle-version 6.8.3` before use `Gradle@2` but its still 7.0. – benadzs Apr 21 '21 at 07:24