Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jdk8 variant of this plugin? #6

Closed
kkocel opened this issue Jul 8, 2021 · 5 comments
Closed

Jdk8 variant of this plugin? #6

kkocel opened this issue Jul 8, 2021 · 5 comments

Comments

@kkocel
Copy link
Contributor

kkocel commented Jul 8, 2021

Recently I tried to use the newest version of gradle-integration-test-plugin and it failed since the project where I applied it had jdk8.

I got the following error message:

No matching variant of com.coditory.gradle:integration-test-plugin:1.2.1 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.0.1' but:
          - Variant 'apiElements' capability com.coditory.gradle:integration-test-plugin:1.2.1 declares a library, packaged as a jar, and its dependencies declared externally:
              - 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

Logs can be found here:
https://github.com/allegro/axion-release-plugin/runs/3008018485

Is there a possibility to make this library jdk8 compatible?

@pmendelski
Copy link
Contributor

I tried to find a solution to this issue (except downgrading dependencies), but I found none.
I will release a fix as soon as I find official workaround.
Till that time I'm open for suggestions or PRs.

@kkocel
Copy link
Contributor Author

kkocel commented Jul 15, 2021

Just a wild guess (haven't tried it etc.) but maybe you could define JVM toolchain? https://docs.gradle.org/current/userguide/toolchains.html

@kkocel
Copy link
Contributor Author

kkocel commented Jul 20, 2021

@pmendelski This PR may help: #8

@pmendelski
Copy link
Contributor

@kkocel Many thanks for the very first external contribution to this project 🎉

I've just released the plugin under v1.2.3.
Please let me know if it works with your project.

@kkocel
Copy link
Contributor Author

kkocel commented Jul 21, 2021

I checked it with the axion plugin and it works.

Why it's working?

It turns out that Gradle started to publish Gradle Module Metadata which is superior to pom files.

Inside pom file you can read:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <!-- This module was also published with a richer model, Gradle metadata,  -->
  <!-- which should be used instead. Do not delete the following line which  -->
  <!-- is to indicate to Gradle or any Gradle module metadata file consumer  -->
  <!-- that they should prefer consuming it instead. -->
  <!-- do_not_remove: published-with-gradle-metadata -->

Gradle Module Metadata declares which JVM version was used to build the library, and since you used Java 11:

 "org.gradle.jvm.version": 11,

So defining explicit version in the JVM toolchain and updating GitHub workflow did the trick :)

@kkocel kkocel closed this as completed Jul 21, 2021
pmendelski referenced this issue in coditory/gradle-manifest-plugin Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants