gradle-build-action icon indicating copy to clipboard operation
gradle-build-action copied to clipboard

Exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63

Open Goooler opened this issue 2 years ago • 3 comments

Build with gradle-build-action on ubuntu-latest:

* What went wrong:
Could not open cp_init generic class cache for initialization script '/home/runner/.gradle/init.d/build-result-capture.init.gradle' (/home/runner/.gradle/caches/7.5.1/scripts/1e64q25zpdl12rebgg3luboth).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63

But if I replace ubuntu-latest with buildjet-8vcpu-ubuntu-2204, no error occurred.

My env: Gradle 7.5.1, gradle-build-action@v2, ubuntu-latest, Java 19, you can repro this issue on https://github.com/Goooler/DemoApp/pull/235.

Goooler avatar Oct 01 '22 15:10 Goooler

Gradle 7.5.1 does not support running on Java 19. I suspect that's the cause of the exception you're seeing, but I don't understand why switching to a different runner fixes it.

Can you please check if this problem occurs when running on Java 18, the newest version supported for Gradle 7.5.1? https://docs.gradle.org/7.5.1/release-notes.html#new-features-and-usability-improvements

bigdaz avatar Oct 04 '22 04:10 bigdaz

but I don't understand why switching to a different runner fixes it.

I'm suspecting the /home/runner/.gradle/init.d/build-result-capture.init.gradle hadn't been restored on buildjet-ubuntu?

Test on Java 18, it works, see https://github.com/Goooler/DemoApp/pull/238.

Goooler avatar Oct 04 '22 04:10 Goooler

I was also running lint tasks on Java 19, they were workable, just failed on the build job, the build-result-capture.init.gradle is only dependent on builds?

Goooler avatar Oct 04 '22 04:10 Goooler

Alright, /home/runner/.gradle/init.d/build-result-capture.init.gradle has been restored on BuildJet now, I'm closing this issue, more info see https://github.com/Goooler/DemoApp/actions/runs/3307540358/jobs/5459270891

Goooler avatar Oct 23 '22 15:10 Goooler