-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Figured I'd move this to its own issue. We are experiencing issues when bumping setup-gradle
from V2 (gradle-buld-action@v2
) to v4 (also tested with v3). The version bump makes our gradle workflow several minutes slower.
The problem seemingly occurs here. See below for outputs from our workflow.
Specifically, when running run ./gradlew build
after setup-gradle@v4
gradle logs that it cannot find certain directories because they are named in the toolchains.xml
-file after running setup-gradle
. However, after setup-java
has ran, only JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.13-11/x64
and JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.13-11/x64
are set.
Starting a Gradle Daemon (subsequent builds will be faster)
Directory '/home/runner/.gradle/daemon/7.6.4/${env.JAVA_HOME_17_X64}' (Maven Toolchains) used for java installations does not exist
Directory '/home/runner/.gradle/daemon/7.6.4/${env.JAVA_HOME_21_X64}' (Maven Toolchains) used for java installations does not exist
Directory '/home/runner/.gradle/daemon/7.6.4/${env.JAVA_HOME_8_X64}' (Maven Toolchains) used for java installations does not exist
Directory '/home/runner/.gradle/daemon/7.6.4/${env.JAVA_HOME_11_X64}' (Maven Toolchains) used for java installations does not exist
Hi, @bigdaz. We are experiencing the same issues @TWiStErRob was. I will answer your questions to him with my own configuration and findings. Judging by my
toolchains.xml
-file after thesetup-gradle
step it seems the action overrides its content with a bad configuration (possibly when it logsMerged default JDK locations into /home/runner/.m2/toolchains.xml
).Let me know if you want me to address this in a new issue.
Does the setup-java step precede the setup-gradle step in your workflow?
Yes. See the output ofsetup-java
below.Output from setup-java
Run actions/setup-java@v4 with: java-version: 17 distribution: temurin java-package: jdk check-latest: false server-id: github server-username: GITHUB_ACTOR server-password: GITHUB_TOKEN overwrite-settings: true job-status: success token: *** Installed distributions Resolved Java 17.0.13+11 from tool-cache Setting Java 17.0.13+11 as the default Creating toolchains.xml for JDK version 17 from temurin Writing to /home/runner/.m2/toolchains.xml Java configuration: Distribution: temurin Version: 17.0.13+11 Path: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.13-11/x64 Creating settings.xml with server-id: github Writing to /home/runner/.m2/settings.xml
The warnings you see: are they emitted by the setup-gradle step, or by a later step that executes a Gradle build?
They are logged by my subsequent
./gradlew build
. See output ofsetup-gradle
below.setup-gradle output
Run gradle/actions/[email protected] with: cache-disabled: false cache-read-only: true cache-write-only: false cache-overwrite-existing: false cache-cleanup: on-success gradle-home-cache-includes: caches notifications add-job-summary: always add-job-summary-as-pr-comment: never dependency-graph: disabled dependency-graph-report-dir: dependency-graph-reports dependency-graph-continue-on-failure: true build-scan-publish: false validate-wrappers: true allow-snapshot-wrappers: false gradle-home-cache-strict-match: false workflow-job-context: null github-token: *** env: JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.13-11/x64 JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.13-11/x64 Merged default JDK locations into /home/runner/.m2/toolchains.xml Restore Gradle state from cache Gradle User Home cache not found. Will initialize empty. All Gradle Wrapper jars are valid ✓ Found known Gradle Wrapper JAR files: 14dfa961b6704bb3decdea06502781edaa796a82e6da41cd2e1962b14fbe21a3 gradle/wrapper/gradle-wrapper.jar
Are the referenced environment variables (eg JAVA_HOME_21_X64) defined at the point the warnings are emitted, and do they provide an absolute path to an installed JDK?
Yes. See the below environment variables for my
run: ./gradlew build
./gradlew initial output
Run ./gradlew $gradle_operations ./gradlew $gradle_operations shell: /usr/bin/bash -e {0} env: JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.13-11/x64 JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.13-11/x64 GRADLE_ACTION_ID: gradle/actions/setup-gradle GRADLE_USER_HOME: /home/runner/.gradle GRADLE_BUILD_ACTION_SETUP_COMPLETED: true GRADLE_BUILD_ACTION_CACHE_RESTORED: true DEVELOCITY_INJECTION_INIT_SCRIPT_NAME: gradle-actions.inject-develocity.init.gradle DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE: gradle-actions GITHUB_DEPENDENCY_GRAPH_ENABLED: false REPO: redacted gradle_operations: build Downloading https://services.gradle.org/distributions/gradle-7.6.4-bin.zip ...........10%............20%............30%...........40%............50%............60%...........70%............80%............90%............100% Welcome to Gradle 7.6.4! Here are the highlights of this release: - Added support for Java 19. - Introduced `--rerun` flag for individual task rerun. - Improved dependency block for test suites to be strongly typed. - Added a pluggable system for Java toolchains provisioning. For more details see https://docs.gradle.org/7.6.4/release-notes.html Starting a Gradle Daemon (subsequent builds will be faster) Directory '/home/runner/.gradle/daemon/7.6.4/${env.JAVA_HOME_11_X64}' (Maven Toolchains) used for java installations does not exist Directory '/home/runner/.gradle/daemon/7.6.4/${env.JAVA_HOME_17_X64}' (Maven Toolchains) used for java installations does not exist Directory '/home/runner/.gradle/daemon/7.6.4/${env.JAVA_HOME_8_X64}' (Maven Toolchains) used for java installations does not exist Directory '/home/runner/.gradle/daemon/7.6.4/${env.JAVA_HOME_21_X64}' (Maven Toolchains) used for java installations does not exist Task :checkKotlinGradlePluginConfigurationErrors
What is the content of /home/runner/.m2/toolchains.xml both before and after the setup-gradle step?
toolchains.xml before
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd"> <toolchain> <type>jdk</type> <provides> <version>17</version> <vendor>temurin</vendor> <id>temurin_17</id> </provides> <configuration> <jdkHome>/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.13-11/x64</jdkHome> </configuration> </toolchain> </toolchains>
toolchains.xml after
<!-- JDK Toolchains installed by default on GitHub-hosted runners --> <toolchain> <type>jdk</type> <provides> <version>21</version> </provides> <configuration> <jdkHome>${env.JAVA_HOME_21_X64}</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> <version>8</version> </provides> <configuration> <jdkHome>${env.JAVA_HOME_8_X64}</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> <version>11</version> </provides> <configuration> <jdkHome>${env.JAVA_HOME_11_X64}</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> <version>17</version> </provides> <configuration> <jdkHome>${env.JAVA_HOME_17_X64}</jdkHome> </configuration> </toolchain> </toolchains>