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

Support custom version catalogs configured through settings.gradle[.kts] #6831

Open
deivid-rodriguez opened this issue Mar 14, 2023 · 1 comment
Labels
L: java:gradle Maven packages via Gradle

Comments

@deivid-rodriguez
Copy link
Contributor

After #6249, we support updating standard Gradle version catalogs, but we don't yet support custom catalogs defined through from in the settings dsl.

gradle/libs.versions.toml is just the default convention that gradle will pickup without having to explicitly list it in your settings.gradle[.kts], but you can import a toml catalog from any arbitrary path.

https://docs.gradle.org/current/userguide/platforms.html#sec:importing-catalog-from-file

More information from posted by @trevjonez in #6249 (comment)_:

I would suspect handling any toml file in the given config directory would be safe? Or rather/maybe root_dir/gradle/*.toml + root_dir/*.toml? or maybe grep out lines using from("*.toml") to build the list of catalogs?

FWIW gradle does enforce that from can only be called once per catalog.

dependencyResolutionManagement {
    versionCatalogs {
        create("libs") {
            from("boom.versions.toml")
        }
    }
}

produces:

Invalid catalog definition:
  - Problem: In version catalog libs, you can only call the 'from' method a single time.

* Try:
> Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.InvalidUserDataException: Invalid catalog definition:
  - Problem: In version catalog libs, you can only call the 'from' method a single time.
    
    Reason: The method was called more than once.
    
    Possible solution: Remove further usages of the method call.
    
    Please refer to https://docs.gradle.org/7.6/userguide/version_catalog_problems.html#too_many_import_invocation for more details about this problem.
	at org.gradle.api.internal.catalog.problems.DefaultCatalogProblemBuilder.maybeThrowError(DefaultCatalogProblemBuilder.java:66)
[...]
@jeffwidman
Copy link
Member

Related:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: java:gradle Maven packages via Gradle
Projects
None yet
Development

No branches or pull requests

2 participants