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

Gradle plugin 6.6.1 introduces conflicting variant "spotless123" #1215

Closed
snazy opened this issue May 18, 2022 · 5 comments · Fixed by #1447
Closed

Gradle plugin 6.6.1 introduces conflicting variant "spotless123" #1215

snazy opened this issue May 18, 2022 · 5 comments · Fixed by #1447
Labels

Comments

@snazy
Copy link

snazy commented May 18, 2022

(See also projectnessie/cel-java#185 )

Steps to reproduce:

Downgrading the spotless plugin (in settings.gradle.kts) to 6.6.0 "fixes" the problem.

CEL-Java uses the Gradle rootProject for dependency management, as that's the easiest way that also works with dependabot.
So submodules use platform(rootProject) for pull in dependency versions.
This started to fail with the Spotless Gradle plugin 6.6.1.

It seems that the temporary configurations ("spotless123...") leak variants that are too similar to "regular" variants and cause the conflict. Probably due to some daemon-leak fix in 6.6.1 that causes (too?) eager configuration/variant creation.

$ ./gradlew check -x jmh 
Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':conformance:test'.
> Could not resolve all task dependencies for configuration ':conformance:testRuntimeClasspath'.
   > Could not resolve project :.
     Required by:
         project :conformance
         project :conformance > project :core
         project :conformance > project :generated-pb
      > The consumer was configured to find a runtime of a platform compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally. However we cannot choose between the following variants of project ::
          - runtimeElements
          - spotless1316845950
        All of them match the consumer attributes:
          - Variant 'runtimeElements' capability org.projectnessie.cel:cel-java:0.3.4-SNAPSHOT declares a runtime of a platform:
              - Unmatched attributes:
                  - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
          - Variant 'spotless1316845950' capability org.projectnessie.cel:cel-java:0.3.4-SNAPSHOT declares a component, and its dependencies declared externally:
              - Unmatched attributes:
                  - Doesn't say anything about its component category (required a platform)
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about its usage (required a runtime)
        The following variants were also considered but didn't match the requested attributes:
          - Variant 'apiElements' capability org.projectnessie.cel:cel-java:0.3.4-SNAPSHOT declares a platform:
              - Incompatible because this component declares an API of a component and the consumer needed a runtime of a component
              - Other compatible attributes:
                  - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
          - Variant 'enforcedApiElements' capability org.projectnessie.cel:cel-java-derived-enforced-platform:0.3.4-SNAPSHOT:
              - Incompatible because this component declares an API of an enforced platform and the consumer needed a runtime of a platform
              - Other compatible attributes:
                  - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
          - Variant 'enforcedRuntimeElements' capability org.projectnessie.cel:cel-java-derived-enforced-platform:0.3.4-SNAPSHOT declares a runtime of a component:
              - Incompatible because this component declares an enforced platform and the consumer needed a platform
              - Other compatible attributes:
                  - Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
                  - Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
                  - Doesn't say anything about its target Java version (required compatibility with Java 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
   > Could not find com.google.protobuf:protobuf-java:.
     Required by:
         project :conformance
         project :conformance > project :generated-pb
   > Could not find io.grpc:grpc-protobuf:.
     Required by:
         project :conformance
   > Could not find io.grpc:grpc-stub:.
     Required by:
         project :conformance
   > Could not find io.grpc:grpc-netty-shaded:.
     Required by:
         project :conformance
   > Could not find org.assertj:assertj-core:.
     Required by:
         project :conformance
   > Could not find org.junit.jupiter:junit-jupiter-api:.
     Required by:
         project :conformance
   > Could not find org.junit.jupiter:junit-jupiter-params:.
     Required by:
         project :conformance
   > Could not find org.junit.jupiter:junit-jupiter-engine:.
     Required by:
         project :conformance
   > Could not find org.agrona:agrona:.
     Required by:
         project :conformance > project :core
@nedtwigg nedtwigg added the bug label May 19, 2022
@nedtwigg
Copy link
Member

Thanks for reporting this bug. I think you can workaround it with a spotlessPredeclare block.

@snazy
Copy link
Author

snazy commented May 21, 2022

I tried the spotlessPredeclare approach here, but it sadly didn't change the outcome. In fact, the spotlessPredeclare adds another variant, so there are now 2 spotless variants.

@snazy
Copy link
Author

snazy commented Jul 7, 2022

Ran into the same issue w/ latest spotless plugin version 6.8.0 in another way (projectnessie/nessie#4655). The change that caused the issue to happen was an unrelated dependency version bump.

snazy added a commit to snazy/nessie that referenced this issue Jul 7, 2022
snazy added a commit to snazy/nessie that referenced this issue Jul 7, 2022
snazy added a commit to projectnessie/nessie that referenced this issue Jul 7, 2022
@JavierSegoviaCordoba
Copy link
Contributor

JavierSegoviaCordoba commented Jul 12, 2022

Run into the same issue, and for some reason, the spotlessPredeclare extension is not available to check if it works on my issue.

My root project has a custom name, maybe that is the reason Spotless is not generating the extension.

@nedtwigg
Copy link
Member

Fix published in plugin-gradle 6.13.0, thanks @JakeWharton for the PR.

snazy added a commit to snazy/nessie that referenced this issue Jan 16, 2023
Since diffplug/spotless#1215 has been closed, a few Github workflow steps can be simplified.
snazy added a commit to projectnessie/nessie that referenced this issue Jan 16, 2023
Since diffplug/spotless#1215 has been closed, a few Github workflow steps can be simplified.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants