Failed to apply plugin 'com.gorylenko.gradle-git-properties

May 2024 ยท 2 minute read

Currently working on a gradle project am not familiar with gradle so it's a learning curve.

am encountering below error which seems to be clear but confusing me.

Caused by: java.lang.UnsupportedClassVersionError: org/eclipse/jgit/api/errors/JGitInternalException has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I have Java 8 installed in my PC and below is my gradle.build file

1 ext { 2 springBootVersion = '2.2.11.RELEASE' 3 } 4 repositories { 5 mavenCentral() 6 maven { 7 url "https://plugins.gradle.org/m2/" 8 } 9 } 10 dependencies { 11 classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 12 classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-RC3' 13 classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:2.2.4" //TODO investigate 14 classpath "com.diffplug.spotless:spotless-plugin-gradle:5.12.5" 15 } 16} 17 18 apply plugin: 'java' 19 apply plugin: 'idea' 20 apply plugin: 'org.springframework.boot' 21 apply plugin: 'io.spring.dependency-management' 22 apply plugin: 'war' 23 apply plugin: 'org.junit.platform.gradle.plugin' 24 apply plugin: 'com.gorylenko.gradle-git-properties' // TODO investigate 25 apply plugin: 'com.diffplug.spotless' 26 27 group = 'io.sndk7' 28 version = '0.0.1' 29 sourceCompatibility = 1.8 it's failing on line number 24 while trying to apply the plugin which is added as a dependence on line 13 
0

1 Answer

The git plugin you're using relies on jgit

Jgit has moved to be Java 11+ so won't work on Java 8

https://github.com/n0mer/gradle-git-properties/issues/195

Shows workarounds to get it to work on Java 8

Or... You could migrate your project to Java 11+

1

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobmlwYWaEcXyOn5iipJWZerW7jJqnqaSpYr2twcaipWabn6J6qLvRsqOeppukeqi%2BwJ2jnmWXnsFuvNGop56qpJ6ytA%3D%3D