I have a GitHub repository for an IntelliJ plugin I wrote. I want a workflow that runs ./gradlew build
and upload the artifact on push.
Here's what I currently have:
name: Make ZIP file
on:
push:
jobs:
make-zip:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
-
name: Build with Gradle
run: |
chmod +x gradlew
./gradlew build
-
name: Upload ZIP
uses: actions/upload-artifact@v4
with:
name: zip
path: build/distributions/*
Here's the error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'project'.
> Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
> Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=17, vendor=JETBRAINS, implementation=vendor-specific} for LINUX on x86_64.
> No locally installed toolchains match and toolchain download repositories have not been configured.
I get it: My plugin requires JetBrainsRuntime, which is not installed. The problem is Setup Java doesn't support that distribution.
How do I make this work? I don't want to make a release for every single commit, and the ZIP file must be available for anyone who can read
the repository.
I found out that I needed to have these lines in my settings.gradle.kts
:
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}
See also this issue.