ajoberstar / grgit

The Groovy way to use Git.
https://ajoberstar.org/grgit/main/index.html
Apache License 2.0
517 stars 96 forks source link

Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8 #392

Closed sash-kp closed 1 year ago

sash-kp commented 1 year ago

Hi, We're using Springfox repo which in turn uses grgit as a plugin in its build.gradle like below.

plugins { ... id "org.ajoberstar.grgit" version "4.0.2" id "org.ajoberstar.git-publish" version "3.0.0-rc.1" ... }

gradle version used is : distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip java version is : java 8

The Springfox repo used to get complied successfully before , but when we try building it again after 1 or 2 years without any changes , comilation gets failed with below error which mentions about java 8 and java 11 compatibility. Can you please help here how to get it complied successfully using java 8? Because as mentioned, we haven't changed anything in the repo at all. Still the compilation whihc used to work earlier, isn't working now with java 8.

22:59:06 * What went wrong: 22:59:06 A problem occurred configuring root project 'springfox'. 22:59:06 > Could not resolve all artifacts for configuration ':classpath'. 22:59:06 > Could not resolve org.ajoberstar.grgit:grgit-core:4.0.2. 22:59:06 Required by: 22:59:06 project : > org.ajoberstar.grgit:org.ajoberstar.grgit.gradle.plugin:4.0.2 > org.ajoberstar.grgit:grgit-gradle:4.0.2 22:59:06 > The consumer was configured to find a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of org.ajoberstar.grgit:grgit-core:5.2.0: 22:59:06 - javadocElements 22:59:06 - sourcesElements 22:59:06 All of them match the consumer attributes: 22:59:06 - Variant 'javadocElements' capability org.ajoberstar.grgit:grgit-core:5.2.0 declares a runtime of a component, and its dependencies declared externally: 22:59:06 - Unmatched attributes: 22:59:06 - Provides documentation but the consumer didn't ask for it 22:59:06 - Provides javadocs but the consumer didn't ask for it 22:59:06 - Doesn't say anything about its target Java version (required compatibility with Java 8) 22:59:06 - Doesn't say anything about its elements (required them packaged as a jar) 22:59:06 - Provides release status but the consumer didn't ask for it 22:59:06 - Variant 'sourcesElements' capability org.ajoberstar.grgit:grgit-core:5.2.0 declares a runtime of a component, and its dependencies declared externally: 22:59:06 - Unmatched attributes: 22:59:06 - Provides documentation but the consumer didn't ask for it 22:59:06 - Provides sources but the consumer didn't ask for it 22:59:06 - Doesn't say anything about its target Java version (required compatibility with Java 8) 22:59:06 - Doesn't say anything about its elements (required them packaged as a jar) 22:59:06 - Provides release status but the consumer didn't ask for it 22:59:06 The following variants were also considered but didn't match the requested attributes: 22:59:06 - Variant 'apiElements' capability org.ajoberstar.grgit:grgit-core:5.2.0 declares a component, packaged as a jar, and its dependencies declared externally: 22:59:06 - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8 22:59:06 - Variant 'runtimeElements' capability org.ajoberstar.grgit:grgit-core:5.2.0 declares a runtime of a component, packaged as a jar, and its dependencies declared externally: 22:59:06 - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8 22:59:06 > Could not resolve org.ajoberstar.grgit:grgit-core:latest.release. 22:59:06 Required by: 22:59:06 project : > org.ajoberstar.git-publish:org.ajoberstar.git-publish.gradle.plugin:3.0.0-rc.1 > org.ajoberstar:gradle-git-publish:3.0.0-rc.1 22:59:06 > The consumer was configured to find a runtime of a component compatible with Java 8, packaged as a jar, and its dependencies declared externally. However we cannot choose between the following variants of org.ajoberstar.grgit:grgit-core:5.2.0: 22:59:06 - javadocElements 22:59:06 - sourcesElements 22:59:06 All of them match the consumer attributes: 22:59:06 - Variant 'javadocElements' capability org.ajoberstar.grgit:grgit-core:5.2.0 declares a runtime of a component, and its dependencies declared externally: 22:59:06 - Unmatched attributes: 22:59:06 - Provides documentation but the consumer didn't ask for it 22:59:06 - Provides javadocs but the consumer didn't ask for it 22:59:06 - Doesn't say anything about its target Java version (required compatibility with Java 8) 22:59:06 - Doesn't say anything about its elements (required them packaged as a jar) 22:59:06 - Provides release status but the consumer didn't ask for it 22:59:06 - Variant 'sourcesElements' capability org.ajoberstar.grgit:grgit-core:5.2.0 declares a runtime of a component, and its dependencies declared externally: 22:59:06 - Unmatched attributes: 22:59:06 - Provides documentation but the consumer didn't ask for it 22:59:06 - Provides sources but the consumer didn't ask for it 22:59:06 - Doesn't say anything about its target Java version (required compatibility with Java 8) 22:59:06 - Doesn't say anything about its elements (required them packaged as a jar) 22:59:06 - Provides release status but the consumer didn't ask for it 22:59:06 The following variants were also considered but didn't match the requested attributes: 22:59:06 - Variant 'apiElements' capability org.ajoberstar.grgit:grgit-core:5.2.0 declares a component, packaged as a jar, and its dependencies declared externally: 22:59:06 - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8 22:59:06 - Variant 'runtimeElements' capability org.ajoberstar.grgit:grgit-core:5.2.0 declares a runtime of a component, packaged as a jar, and its dependencies declared externally: 22:59:06 - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8

Vampire commented 1 year ago

grgit 5 needs Java 11 as it uses a JGit version only supporting Java 11+. git-publish in the version you use unfortunately uses a dynamic version and without upper bound, so as grgit 5 was released, it is now used transitively and causes that issue. Update git-publish to a newer version that does not have a dynamic version and still uses grgit 4.