如何让CircleCI使用特定的Gradle版本?

lx0bsm1f  于 2023-10-19  发布在  其他
关注(0)|答案(1)|浏览(110)

它仍然使用2.14.1,而我想要的是3.3:
尽管下面的circle.yml:

machine:
  environment:
    PATH: "~/$CIRCLE_PROJECT_REPONAME/gradle-3.3/bin:$PATH"
    TERM: "dumb"
    ADB_INSTALL_TIMEOUT: "10"
    GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
  java:
    version: oraclejdk8

dependencies:
  pre:
    # Install Android stuffs
    - wget "https://services.gradle.org/distributions/gradle-3.3-bin.zip"; unzip gradle-3.3-bin.zip
    - echo y | android update sdk --no-ui --all --filter tool
    - echo y | android update sdk --no-ui --all --filter extra-android-m2repository
    - echo y | android update sdk --no-ui --all --filter extra-android-support
    - echo y | android update sdk --no-ui --all --filter extra-google-google_play_services
    - echo y | android update sdk --no-ui --all --filter extra-google-m2repository
    - echo y | android update sdk --no-ui --all --filter android-25
    - echo y | android update sdk --no-ui --all --filter build-tools-25.0.2
test:
  override:
    # start the emulator
    - emulator -avd circleci-android19 -no-audio -no-window:
        background: true
        parallel: true
    # wait for it to have booted
    - circle-android wait-for-boot
    # unlock the emulator screen
    - sleep 30
    - adb shell input keyevent 82

错误的版本可能是gradle dependencies在这里失败的原因:

eanckbw9

eanckbw91#

yourProject/gradle/wrapper/gradle-wrapper.properties"中,您可以定义gradle版本。就像这样:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip `

更新

我认为没有必要wget "https://services.gradle.org/distributions/gradle-3.3-bin.zip",因为当CI调用./gradlew时,它会自动下载gradle。

相关问题