JetBrains / intellij-platform-plugin-template

Template repository for creating plugins for IntelliJ Platform
Apache License 2.0
2.97k stars 587 forks source link

build.yml reports "Cannot find a Java installation" #447

Closed InSyncWithFoo closed 4 months ago

InSyncWithFoo commented 4 months ago

This workflow failed, saying it found no Java installation vendored by JetBrains:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'pyright'.
> 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.

The commit that triggered the workflow only changed the workflow file by a tiny bit: it added chmod +x ./gradlew. How does the same workflow for this template work? setup-java doesn't support JetBrainsRuntime.

I have tried creating a new repository using this template for about 20 times. The results are indeterministic: sometimes it fails, sometimes it succeeds, even with the same content and the same settings. For example, this repository, which was generated from the template rather than manually created, had the workflow running normally.

InSyncWithFoo commented 4 months ago

It seems that the following lines are necessary:

https://github.com/JetBrains/intellij-platform-plugin-template/blob/c25c79d3edcccbbcd33eb72e1096d794091207ee/settings.gradle.kts#L1-L3

The result is possibly cached, which allows later runs to succeed.