Add support for Gradle 7.4 Version Catalogs
See original GitHub issueGradle 7.0 introduced the “centralized declaration of dependencies”.
Namely, dependencies can be aliased, grouped, and versioned in a TOML file.
It would be incredibly nice if refreshVersions could target the libs.versions.toml
file in future, rather than relying on a custom version.properties
.
Update: notes from jmfayard
the plan for now is not to give up versions.properties
it’s to auto-generate the libraries versions catalog, with the placeholder version _
and use the typesafe accessors to help migrate an existing project to refreshVersions
Running $ ./gradlew refreshVersionsCatalog
would
- Enable catalog version if necessary
// Enable Gradle's version catalog support
// https://docs.gradle.org/current/userguide/platforms.html
enableFeaturePreview("VERSION_CATALOGS")
- Generate versions.properties, with all version keys (marked as unused)
- Generate
gradle/libs.dependencies.toml
- Use the IDE and auto-completion to replace hardcoded dependencies with refreshVerion’s dependency notations and versionCatalog or buildSrc/Libs.kt
- To help with this, this task will show which typesafe accessors are available
$ ./ gradlew refreshVersionsMapping
androidx.car:car | AndroidX.car
com.retrofit:retrofit-converter-json | Square.retrofit.converter.json
org.koin:koin | libs.koin
Documentation
Issue Analytics
- State:
- Created 2 years ago
- Reactions:22
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Sharing dependency versions between projects
A version catalog is a list of dependencies, represented as dependency coordinates, that a user can pick from when declaring dependencies in a...
Read more >Gradle version catalogs for an awesome ... - ProAndroidDev
You can create the version catalogs manually in settings.gradle but the easiest way is to use a TOML file which will be really...
Read more >Gradle version catalogs for an awesome ... - Droidcon
Implementing Version Catalogs: 1️. Make sure you are using Gradle 7.4 or newer. This is easily checked using: ./gradlew --version.
Read more >Integrating Version Catalog | Medium - Umang Chamaria
Version catalog is a preview feature currently(in Gradle version 7.x.x) hence the feature needs to be enabled in your project's settings.gradle(.kts) file as ......
Read more >Manage your dependencies with Gradle version catalogs
Version Catalogs are a native Gradle solution for managing dependency versions in your build scripts. They provide a version catalog DSL, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve got news! cc @DanySK @beski @jsschneider @NikkyAI and all.
I implemented support for versions catalog:
build.gradle(.kts)
to use themgradle/libs.versions.toml
It’s published in the snapshot version
"0.40.2-SNAPSHOT"
Have a look at the Testing? pargraph from the pull-request https://github.com/jmfayard/refreshVersions/pull/509
I have a plan to combine versions catalog and refreshVersions. I updated the issue with my notes