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

Transitive dependency rejection after Guava upgrade to 32.1.3-jre #14123

Closed
dtrunk90 opened this issue Dec 8, 2023 · 15 comments
Closed

Transitive dependency rejection after Guava upgrade to 32.1.3-jre #14123

dtrunk90 opened this issue Dec 8, 2023 · 15 comments

Comments

@dtrunk90
Copy link
Contributor

dtrunk90 commented Dec 8, 2023

With checkstyle 10.12.6 guava was upgraded from 32.0.1-jre to 32.1.3-jre
Since there'S also a transitive dependency to com.google.collections:google-collections:1.0 through org.apache.maven.doxia:doxia-core:1.12.0 gradle task :checkstyleMain fails with:

> Could not resolve all files for configuration ':checkstyle'.
   > Could not resolve com.google.guava:guava:32.1.3-jre.
     Required by:
         project : > com.puppycrawl.tools:checkstyle:10.12.6
      > Module 'com.google.guava:guava' has been rejected:
           Cannot select module with conflict on capability 'com.google.collections:google-collections:32.1.3-jre' also provided by [com.google.collections:google-collections:1.0(runtime)]
   > Could not resolve com.google.collections:google-collections:1.0.
     Required by:
         project : > com.puppycrawl.tools:checkstyle:10.12.6 > org.apache.maven.doxia:doxia-core:1.12.0 > org.codehaus.plexus:plexus-container-default:2.1.0
      > Module 'com.google.collections:google-collections' has been rejected:
           Cannot select module with conflict on capability 'com.google.collections:google-collections:1.0' also provided by [com.google.guava:guava:32.1.3-jre(jreRuntimeElements)]

There's a workaround reported here: gradle/gradle#27035 (comment)
But I guess it's better to exclude com.google.collections:google-collections:1.0 because it's part of guava anyway.

See also https://github.com/slugify/slugify/actions/runs/7125400022/job/19431918771?pr=175 if you need a reproduction.

@romani
Copy link
Member

romani commented Dec 8, 2023

@dtrunk90, if you know a fix please send a PR.

@romani romani added the approved label Dec 8, 2023
XN137 added a commit to XN137/checkstyle that referenced this issue Dec 13, 2023
by upgrading transitively used plexus-container-default to 2.1.1

before:
```
[INFO] --- dependency:3.6.1:tree (default-cli) @ checkstyle ---
[INFO] com.puppycrawl.tools:checkstyle:jar:10.12.7-SNAPSHOT
(...)
[INFO] +- org.apache.maven.doxia:doxia-core:jar:1.12.0:compile
[INFO] |  +- org.apache.maven.doxia:doxia-sink-api:jar:1.12.0:compile
[INFO] |  +- org.apache.maven.doxia:doxia-logging-api:jar:1.12.0:compile
[INFO] |  +- org.codehaus.plexus:plexus-utils:jar:3.3.0:compile
[INFO] |  +- org.codehaus.plexus:plexus-container-default:jar:2.1.0:compile
[INFO] |  |  +- org.codehaus.plexus:plexus-classworlds:jar:2.6.0:compile
[INFO] |  |  +- org.apache.xbean:xbean-reflect:jar:3.7:compile
[INFO] |  |  \- com.google.collections:google-collections:jar:1.0:compile
[INFO] |  +- org.codehaus.plexus:plexus-component-annotations:jar:2.1.0:compile
(...)
```

after:
```
[INFO] --- dependency:3.6.1:tree (default-cli) @ checkstyle ---
[INFO] com.puppycrawl.tools:checkstyle:jar:10.12.7-SNAPSHOT
(...)
[INFO] +- org.apache.maven.doxia:doxia-core:jar:1.12.0:compile
[INFO] |  +- org.apache.maven.doxia:doxia-sink-api:jar:1.12.0:compile
[INFO] |  +- org.apache.maven.doxia:doxia-logging-api:jar:1.12.0:compile
[INFO] |  +- org.codehaus.plexus:plexus-utils:jar:3.3.0:compile
[INFO] |  +- org.codehaus.plexus:plexus-container-default:jar:2.1.1:compile
[INFO] |  |  +- org.codehaus.plexus:plexus-classworlds:jar:2.6.0:compile
[INFO] |  |  \- org.apache.xbean:xbean-reflect:jar:3.7:compile
[INFO] |  +- org.codehaus.plexus:plexus-component-annotations:jar:2.1.0:compile
(...)
```
XN137 added a commit to XN137/checkstyle that referenced this issue Dec 13, 2023
by upgrading transitively used plexus-container-default to 2.1.1

before:
```
[INFO] --- dependency:3.6.1:tree (default-cli) @ checkstyle ---
[INFO] com.puppycrawl.tools:checkstyle:jar:10.12.7-SNAPSHOT
(...)
[INFO] +- org.apache.maven.doxia:doxia-core:jar:1.12.0:compile
[INFO] |  +- org.apache.maven.doxia:doxia-sink-api:jar:1.12.0:compile
[INFO] |  +- org.apache.maven.doxia:doxia-logging-api:jar:1.12.0:compile
[INFO] |  +- org.codehaus.plexus:plexus-utils:jar:3.3.0:compile
[INFO] |  +- org.codehaus.plexus:plexus-container-default:jar:2.1.0:compile
[INFO] |  |  +- org.codehaus.plexus:plexus-classworlds:jar:2.6.0:compile
[INFO] |  |  +- org.apache.xbean:xbean-reflect:jar:3.7:compile
[INFO] |  |  \- com.google.collections:google-collections:jar:1.0:compile
[INFO] |  +- org.codehaus.plexus:plexus-component-annotations:jar:2.1.0:compile
(...)
```

after:
```
[INFO] --- dependency:3.6.1:tree (default-cli) @ checkstyle ---
[INFO] com.puppycrawl.tools:checkstyle:jar:10.12.7-SNAPSHOT
(...)
[INFO] +- org.apache.maven.doxia:doxia-core:jar:1.12.0:compile
[INFO] |  +- org.apache.maven.doxia:doxia-sink-api:jar:1.12.0:compile
[INFO] |  +- org.apache.maven.doxia:doxia-logging-api:jar:1.12.0:compile
[INFO] |  +- org.codehaus.plexus:plexus-utils:jar:3.3.0:compile
[INFO] |  +- org.codehaus.plexus:plexus-container-default:jar:2.1.1:compile
[INFO] |  |  +- org.codehaus.plexus:plexus-classworlds:jar:2.6.0:compile
[INFO] |  |  \- org.apache.xbean:xbean-reflect:jar:3.7:compile
[INFO] |  +- org.codehaus.plexus:plexus-component-annotations:jar:2.1.0:compile
(...)
```
XN137 added a commit to XN137/checkstyle that referenced this issue Dec 13, 2023
by upgrading plexus-container-default to 2.1.1 which gets used by
doxia-core
XN137 added a commit to XN137/checkstyle that referenced this issue Dec 13, 2023
@XN137
Copy link
Contributor

XN137 commented Dec 13, 2023

i've submitted a PR here that should fix this issue

also asked why the missing upgrade was not included here a long time ago

XN137 added a commit to XN137/checkstyle that referenced this issue Dec 16, 2023
valfirst added a commit to vividus-framework/vividus-build-system that referenced this issue Dec 18, 2023
XN137 added a commit to XN137/checkstyle that referenced this issue Dec 18, 2023
XN137 added a commit to XN137/checkstyle that referenced this issue Dec 18, 2023
@github-actions github-actions bot added this to the 10.12.7 milestone Dec 21, 2023
@nrmancuso
Copy link
Member

nrmancuso commented Dec 21, 2023

@dtrunk90 update is merged, would you like us to make a release so that you can get this resolved sooner on your end?

@nrmancuso
Copy link
Member

Completed via #14140

@dtrunk90
Copy link
Contributor Author

@dtrunk90 update is merged, would you like us to make a release so that you can get this resolved sooner on your end?

Speaking only for me: I don't need to get this resolved sooner. Thank you.

@romani
Copy link
Member

romani commented Dec 21, 2023

We will release it by regular schedule, end of month.

@marcphilipp
Copy link

This still happens with 10.13.0:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':documentation:checkstyleMain'.
> Could not resolve all files for configuration ':documentation:checkstyle'.
   > Could not resolve com.google.guava:guava:33.0.0-jre.
     Required by:
         project :documentation > com.puppycrawl.tools:checkstyle:10.13.0
      > Module 'com.google.guava:guava' has been rejected:
           Cannot select module with conflict on capability 'com.google.collections:google-collections:33.0.0-jre' also provided by [com.google.collections:google-collections:1.0(runtime)]
   > Could not resolve com.google.collections:google-collections:1.0.
     Required by:
         project :documentation > com.puppycrawl.tools:checkstyle:10.13.0 > org.apache.maven.doxia:doxia-core:1.12.0 > org.codehaus.plexus:plexus-container-default:2.1.0
      > Module 'com.google.collections:google-collections' has been rejected:
           Cannot select module with conflict on capability 'com.google.collections:google-collections:1.0' also provided by [com.google.guava:guava:33.0.0-jre(jreRuntimeElements)]

@baron1405
Copy link

baron1405 commented Feb 14, 2024

I am seeing this with 10.13.0 as well. Please reopen. While Gradle's dependency replacement can be used to swap Guava for Google Collections, this is clumsy and unworkable when custom checks are used.

nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Feb 16, 2024
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Feb 16, 2024
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Feb 16, 2024
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Feb 16, 2024
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Feb 16, 2024
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Feb 16, 2024
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Feb 16, 2024
@McPringle
Copy link

I can confirm that this problem still exists with v10.13.0. The last usable version is 10.12.5. Everything newer is broken.

@XN137
Copy link
Contributor

XN137 commented Feb 23, 2024

there was some follow-up discussion in #14211

the workaround did not work in gradle because it seems gradle does not respect <exclusions> in published poms for some reason.

it also discusses the currently available workaround that has to be applied to your build script manually:

configurations.checkstyle {
  resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
    select("com.google.guava:guava:0")
  }
}

@marcphilipp
Copy link

@XN137 Thanks for the update! 👍

@romani
Copy link
Member

romani commented Mar 17, 2024

released https://github.com/checkstyle/checkstyle/releases/tag/checkstyle-10.14.2

@baron1405
Copy link

@romani I can confirm that 10.14.2 works across all my projects including Checkstyle extensions. A big thank you for driving the final fix and subsequent release!

@dtrunk90
Copy link
Contributor Author

Yes, it's fixed now. Thank you! :-)

@sdavids
Copy link

sdavids commented Mar 18, 2024

Verified with:

------------------------------------------------------------
Gradle 8.6
------------------------------------------------------------

Build time:   2024-02-02 16:47:16 UTC
Revision:     d55c486870a0dc6f6278f53d21381396d0741c6e

Kotlin:       1.9.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.10 (Eclipse Adoptium 17.0.10+7)
OS:           Mac OS X 14.4 aarch64
checkstyle = "com.puppycrawl.tools:checkstyle:10.14.2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants