Gradle Wrapper - how to use different distributionUrls for Local vs CI builds?
Asked Answered
P

1

9

I want to use distributionUrl pointing to "ALL" for local builds, but "BIN" for CI builds.

Let's say I run Gradle Wrapper locally like this:

./gradlew test

And my gradle-wrapper.properties file (which is checked-in to VCS) points to "ALL" distribution:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip

Is there a parameter I can pass to ./gradlew test to change distribution-type to BIN?

Posen answered 25/4, 2019 at 12:54 Comment(1)
It seems that --gradle-distribution-url might be helfpul. However it's used when wrapper is generated. Have a look here. It seems that you need to regenerate gradle wrapper on CI and then use it.Aglow
P
5

Run

sed -i 's/all.zip/bin.zip/g' gradle/wrapper/gradle-wrapper.properties

before running ./gradlew on CI.

Imperfect, but it works for me.

Posen answered 30/4, 2019 at 14:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.