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

Version rejectAll() documentation is basically non-existant #30350

Open
toadzky opened this issue Aug 29, 2024 · 7 comments
Open

Version rejectAll() documentation is basically non-existant #30350

toadzky opened this issue Aug 29, 2024 · 7 comments

Comments

@toadzky
Copy link

toadzky commented Aug 29, 2024

Issue type

Missing information

Problem description

I'm trying to write a catalog that allows a consumer to opt-in to a rejectAll version but it fails with a Could not resolve group:artifact:{reject all versions}. There's no documentation on how to correctly use rejectAll and how it interacts with other things.

Context (optional)

No response

Page with the problem

https://docs.gradle.org/current/userguide/platforms.html

@toadzky toadzky added a:documentation Documentation content to-triage labels Aug 29, 2024
@ljacomet
Copy link
Member

ljacomet commented Sep 3, 2024

This is a valid documentation issue.


Documentation is indeed lacking, especially as this value is the only boolean one in the version catalog.
It should be something like:
commons-lang3 = { group = "org.apache.commons", name = "commons-lang3", version = { rejectAll = true } }

@toadzky Can you try the above, adapted to your needs? Could you also share the snippet and the stacktrace at the origin of your issue?

@toadzky
Copy link
Author

toadzky commented Sep 6, 2024

I have defined some rejectAll items in my catalog. Here's what happens when I try to include one as a dependency:

Execution failed for task ':module:compileKotlin'.
> Could not resolve all files for configuration ':module:compileClasspath'.
   > Could not resolve software.amazon.awssdk:apache-client:{reject all versions}.
     Required by:
         project :module
      > Module 'software.amazon.awssdk:apache-client' has been rejected:
           Dependency path 'project:module:unspecified' --> 'software.amazon.awssdk:apache-client:{reject all versions}'

It's unclear in the documentation how to use the rejected dependency. It's relatively clear how to define a rejected dependency, but not how to use it.

@toadzky
Copy link
Author

toadzky commented Sep 6, 2024

Oh, you asked for some snippets....

My catalog is kotlin-defined:

library("aws-sdk-client-reject-apache", "software.amazon.awssdk", "apache-client").version {
  rejectAll()
}

the generated toml look like this:

aws-sdk-client-reject-apache = {group = "software.amazon.awssdk", name = "apache-client", version = { rejectAll = true } }

and the usage i have is

  implementation(libs.aws.sdk.client.reject.apache)

i'm not sure what stacktrace you would like me to send you, i don't see one in the gradle output.

@ljacomet
Copy link
Member

ljacomet commented Sep 9, 2024

Ok, so this is also about the usage of rejectAll as well.

It makes little sense for a dependency since all of its versions will be rejected.

However, it can help blacklist a specific set of coordinates with a dependency constraint though. Since constraints are activated only if a real dependency enters the graph, you can add the constraint and have it only trigger if that blacklisted dependency shows up in an unexpected way.

@toadzky
Copy link
Author

toadzky commented Sep 9, 2024

yeah, i don't really understand what you mean by doing it as a constraint. it's literally a version setting for dependencies, but you are saying it doesn't make sense to use it in the dependency section. this is basically the problem: it's completely unclear how this functionality is supposed to be used, the docs just show how to set the dependency version to be rejected.

@ljacomet
Copy link
Member

ljacomet commented Sep 9, 2024

@toadzky
Copy link
Author

toadzky commented Sep 9, 2024

Gotcha. Yeah, if the docs for rejecting dependencies linked to that and clearly said it was for constraints only, that would help a lot I think.

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

2 participants