diff --git a/.github/workflows/java-gradle.yml b/.github/workflows/java-gradle.yml index 3c8429ee..338f8d25 100644 --- a/.github/workflows/java-gradle.yml +++ b/.github/workflows/java-gradle.yml @@ -28,5 +28,6 @@ jobs: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('java/gradle/*.gradle') }} restore-keys: ${{ runner.os }}-gradle - - run: ./gradlew build + # simulate the bindings + - run: cp bindings/gradle-wrapper/gradle-wrapper.properties gradle/wrapper/gradle-wrapper.properties && ./gradlew build working-directory: java/gradle diff --git a/java/gradle/README.md b/java/gradle/README.md index a67bb7ce..56aaf733 100644 --- a/java/gradle/README.md +++ b/java/gradle/README.md @@ -5,22 +5,30 @@ See [prerequisites](https://paketo.io/docs/howto/java/#prerequisites) of this sa ## Building ```bash -pack build applications/gradle --env BP_JVM_VERSION=17 +pack build applications/gradle ``` -Alternatively, if you want to attach a `gradle.properties` file to pass additional configuration to Gradle. +Alternatively, if you want to attach a `gradle.properties` and/or a `gradle-wrapper.properties` file to pass additional configuration to Gradle (Wrapper). ```bash -pack build applications/gradle --volume $(pwd)/bindings:/platform/bindings --env BP_JVM_VERSION=17 +pack build applications/gradle --volume $(pwd)/bindings:/platform/bindings ``` -The command above will use the sample `gradle.properties` file from this repo. It may be more useful to copy your local `gradle.properties` file first. +The command above will use: + +* the sample `gradle.properties` file from this repo. It may be more useful to copy your local `gradle.properties` file first. ```bash cp ~/.gradle/gradle.properties java/gradle/bindings/gradle/gradle.properties -pack build applications/gradle --volume $(pwd)/bindings:/platform/bindings --env BP_JVM_VERSION=17 +pack build applications/gradle --volume $(pwd)/bindings:/platform/bindings ``` +* the sample `gradle-wrapper.properties` file from this repo. It may be more useful to copy your local `gradle-wrapper.properties` file first. + +```bash +cp ~/gradle/wrapper/gradle-wrapper.properties java/gradle/bindings/gradle-wrapper/gradle-wrapper.properties +pack build applications/gradle --volume $(pwd)/bindings:/platform/bindings + ## Running ```bash diff --git a/java/gradle/bindings/gradle-wrapper/gradle-wrapper.properties b/java/gradle/bindings/gradle-wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..c7f216f6 --- /dev/null +++ b/java/gradle/bindings/gradle-wrapper/gradle-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +networkTimeout=60000 \ No newline at end of file diff --git a/java/gradle/bindings/gradle-wrapper/type b/java/gradle/bindings/gradle-wrapper/type new file mode 100644 index 00000000..f9033942 --- /dev/null +++ b/java/gradle/bindings/gradle-wrapper/type @@ -0,0 +1 @@ +gradle-wrapper \ No newline at end of file diff --git a/java/gradle/gradle/wrapper/gradle-wrapper.properties b/java/gradle/gradle/wrapper/gradle-wrapper.properties index 4e86b927..7c825554 100644 --- a/java/gradle/gradle/wrapper/gradle-wrapper.properties +++ b/java/gradle/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip -networkTimeout=10000 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +networkTimeout=1 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/java/gradle/smoke_test/gradle_test.go b/java/gradle/smoke_test/gradle_test.go index 34e21f3a..e81ca718 100644 --- a/java/gradle/smoke_test/gradle_test.go +++ b/java/gradle/smoke_test/gradle_test.go @@ -101,6 +101,10 @@ func testGradleWithBuilder(builder string) func(*testing.T, spec.G, spec.S) { }). WithBuilder(builder). WithGID("123"). + WithEnv(map[string]string{ + "SERVICE_BINDING_ROOT": "/bindings", + }). + WithVolumes(fmt.Sprintf("%s:/bindings/gradle-wrapper", filepath.Join(source, "bindings/gradle-wrapper"))). Execute(name, source) Expect(err).ToNot(HaveOccurred(), logs.String)