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

update palantirJavaFormat for Java 21 #1822

Closed
wants to merge 2 commits into from
Closed

update palantirJavaFormat for Java 21 #1822

wants to merge 2 commits into from

Conversation

slachiewicz
Copy link
Contributor

Based on @basil user report and fix #1774

CHANGES.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
@nedtwigg nedtwigg changed the title Fix to run with Java 21 update palantirJavaFormat for Java 21 Sep 28, 2023
@nedtwigg
Copy link
Member

Looks like issues around gradle variants.

 project : > com.palantir.javaformat:palantir-java-format:2.38.0 > com.palantir.javaformat:palantir-java-format-spi:2.38.0

  Caused by: org.gradle.internal.component.AmbiguousConfigurationSelectionException: The consumer was configured to find attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.dependency.bundling' with value 'external'. However we cannot choose between the following variants of com.google.guava:guava:32.1.2-jre:
    - androidRuntimeElements
    - jreRuntimeElements
  All of them match the consumer attributes:
    - Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.dependency.bundling' with value 'external':
        - Unmatched attributes:
            - Provides org.gradle.jvm.environment 'android' but the consumer didn't ask for it
            - Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
            - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
            - Provides org.gradle.status 'release' but the consumer didn't ask for it
            - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
    - Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.dependency.bundling' with value 'external':
        - Unmatched attributes:
            - Provides org.gradle.jvm.environment 'standard-jvm' but the consumer didn't ask for it
            - Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
            - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
            - Provides org.gradle.status 'release' but the consumer didn't ask for it
            - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
      at app//com.diffplug.spotless.java.PalantirJavaFormatStepTest.jvm13Features(PalantirJavaFormatStepTest.java:35)

We had similar issues in #1808

@nedtwigg
Copy link
Member

FYI, main is now on Gradle 8.4, so if you want to bring Java 21 back into the test matrix, that would be welcome. I don't think it will help with the variant issue above though...

@slachiewicz slachiewicz marked this pull request as draft September 29, 2023 18:47
@slachiewicz
Copy link
Contributor Author

Unfortunately, it's still the same error with the new Gradle - no idea how to fix this dependency issue.

@nedtwigg nedtwigg marked this pull request as ready for review November 2, 2023 00:24
@nedtwigg
Copy link
Member

nedtwigg commented Nov 2, 2023

Anyone know why this PR isn't running CI? It's doing spotlessCheck assemble testClasses but none of the actual testrunner runs...

@nedtwigg
Copy link
Member

  org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for [com.palantir.javaformat:palantir-java-format:2.38.0].
      at com.diffplug.spotless.java.PalantirJavaFormatStepTest.jvm13Features(PalantirJavaFormatStepTest.java:35)
  Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':detachedConfiguration1'.
      at app//com.diffplug.spotless.java.PalantirJavaFormatStepTest.jvm13Features(PalantirJavaFormatStepTest.java:35)
  Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.google.guava:guava:32.1.2-jre.
  Required by:
      project : > com.palantir.javaformat:palantir-java-format:2.38.0
      project : > com.palantir.javaformat:palantir-java-format:2.38.0 > com.palantir.javaformat:palantir-java-format-spi:2.38.0

  Caused by: org.gradle.internal.component.AmbiguousConfigurationSelectionException: The consumer was configured to find attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.dependency.bundling' with value 'external'. However we cannot choose between the following variants of com.google.guava:guava:32.1.2-jre:
    - androidRuntimeElements
    - jreRuntimeElements
  All of them match the consumer attributes:
    - Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.dependency.bundling' with value 'external':
        - Unmatched attributes:
            - Provides org.gradle.jvm.environment 'android' but the consumer didn't ask for it
            - Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
            - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
            - Provides org.gradle.status 'release' but the consumer didn't ask for it
            - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
    - Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre declares attribute 'org.gradle.category' with value 'library', attribute 'org.gradle.dependency.bundling' with value 'external':
        - Unmatched attributes:
            - Provides org.gradle.jvm.environment 'standard-jvm' but the consumer didn't ask for it
            - Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
            - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
            - Provides org.gradle.status 'release' but the consumer didn't ask for it
            - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
      at app//com.diffplug.spotless.java.PalantirJavaFormatStepTest.jvm13Features(PalantirJavaFormatStepTest.java:35)

@Goooler
Copy link
Member

Goooler commented Nov 28, 2023

@slachiewicz Seems I've fixed the dependency resolving issue, you can ref Goooler#12. And if you wanna run CI on Java 21, still need to fix GJF tests. You may just add .add(21, "2.38.0") but 073a762.

@StefanLobbenmeierObjego
Copy link

StefanLobbenmeierObjego commented Nov 30, 2023

FYI with gradle 8.5 being released today this became more urgent as it blocks users from running gradle on java 21

I could confirm that manually setting the version works for me though (as also shown in this comment: palantir/palantir-java-format#943 (comment))

@Goooler
Copy link
Member

Goooler commented Nov 30, 2023

I was planning to fix Java 21 compatibility issues for Gradle, we can probably fix Maven first.

@steven-sheehy
Copy link
Contributor

@Goooler Is it possible to submit your changes as a separate PR if it's passing CI since this one doesn't seem to see any updates?

@Goooler
Copy link
Member

Goooler commented Dec 1, 2023

It's in #1920.

@nedtwigg
Copy link
Member

nedtwigg commented Dec 3, 2023

@nedtwigg nedtwigg closed this Dec 3, 2023
@nedtwigg
Copy link
Member

nedtwigg commented Dec 4, 2023

Published in plugin-gradle 6.23.3 and plugin-maven 2.41.1.

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

Successfully merging this pull request may close these issues.

Update default versions for palantir-java-format
7 participants