Hi, I need help with version catalog. I have one ...
# general
m
Hi, I need help with version catalog. I have one toml file which I am uploading to our private repository. From there, another 4 projects are supposed to be downloading it. We do not change version of the artifact, because that would be crazy to keep changing while testing changes in dependencies. Also it would mean we still have to create PRs to each project for change of version of version catalog. So each time I upload adjusted .toml file, repository updates which snapshot shold be downloaded, but the other projects are not downloading it. Not just when syncing, but also after manually deleting
projectDir/.gradle/_gradle_version_/dependencies-accessors/_xxx_/sources/org/gradle/accessors/dm/LibrariesForLibs.java
, it would after sync restore the cached old version instead of asking repository for new one. Please help how to clear that gradle cache, thank you
l
Can you share how you import the published TOML ?
m
Yes, for now it is inside root settings.gradle, like this:
Copy code
dependencyResolutionManagement {
    versionCatalogs {
        libs {
            boolean isRelease = BUILD_VARIANT.contains('release')
            from("cz.package:versionCatalog:ml${isRelease ? '' : "-SNAPSHOT"}")
        }
    }
    repositories {
        maven {
            url SECRET_URL
            credentials {
                username ARTIFACT_REPOSITORY_USERNAME
                password ARTIFACT_REPOSITORY_PASSWORD
            }
        }
    }
}
m
if it's a snapshot, it should just work with
--refresh-dependencies
t
To add a note to the melix's answer, take a look at Resolution strategy. You can force Gradle to always check for new SNAPSHOT versions.
m
--refresh-dependencies is working, although it keeps the old snapshots. resolution strategy does not influence this afaik, but I tried it anyway with no luck (both cacheChangingModulesFor and cacheDynamicVersionsFor set to 0) Thank you both
There is another problem. It makes build much slower (big project). As far as I can tell, it has much less dependencies taken from cache. Is it because everything is provider, so it cannot be cached? Side effect of not needing to sync?