question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dependencies not updated

See original GitHub issue

Using ./gradlew versionCatalogUpdate does not update any dependencies. Is something wrong with my config?

settings.gradle.kts

rootProject.name = "kotlin-libs"

dependencyResolutionManagement {
    repositories {
        mavenCentral()
    }
}

build.gradle.kts:

import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

plugins {
    `version-catalog`
    `maven-publish`
    id("com.github.ben-manes.versions") version "0.42.0"
    id("nl.littlerobots.version-catalog-update") version "0.3.1"
}

group = "some.group"
version = "0.0.12"

catalog {
    versionCatalog {
        from(files("gradle/libs.versions.toml"))
        library("my-libs", "some.group:kotlin-libs:$version")
    }
}

publishing {
    publications {
        create<MavenPublication>("maven") {
            from(components["versionCatalog"])
        }
    }
    repositories {
        maven {
            credentials {
                username = System.getenv("MAVEN_USERNAME")
                password = System.getenv("MAVEN_PASSWORD")
            }
            url = uri(System.getenv("MAVEN_URL")
        }
    }
}

fun isNonStable(version: String): Boolean {
    val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
    val regex = "^[0-9,.v-]+(-r)?$".toRegex()
    val isStable = stableKeyword || regex.matches(version)
    return isStable.not()
}

tasks.withType<DependencyUpdatesTask> {
    rejectVersionIf {
        isNonStable(candidate.version)
    }
}

versionCatalogUpdate {
    sortByKey.set(true)
    pin {
    }
    keep {
        keepUnusedVersions.set(true)
        keepUnusedLibraries.set(true)
        keepUnusedPlugins.set(true)
    }
}

gradle/libs.versions.toml:

[versions]
com-google-auth = "1.5.3"
com-sksamuel-hoplite = "1.4.16"
com-squareup-okhttp3 = "4.9.3"
com-squareup-retrofit2 = "2.9.0"
com-squareup-sqldelight = "1.5.3"
io-github-resilience4j = "1.7.1"
io-insert-koin = "3.1.5"
kotlin = "1.6.10"
ktor = "1.6.8"
org-antlr = "4.9.3"
org-junit-jupiter = "5.8.2"

[libraries]
ch-qos-logback-logback-classic = "ch.qos.logback:logback-classic:1.2.11"
com-codeborne-selenide = "com.codeborne:selenide:6.3.4"
com-esotericsoftware-kryo = "com.esotericsoftware:kryo:5.3.0"
com-github-ajalt-clikt = "com.github.ajalt:clikt:2.8.0"
com-github-ajalt-clikt-clikt = "com.github.ajalt.clikt:clikt:3.4.0"
com-github-ben-manes-gradle-versions-plugin = "com.github.ben-manes:gradle-versions-plugin:0.42.0"
com-github-freva-ascii-table = "com.github.freva:ascii-table:1.2.0"
com-github-spullara-mustache-java-compiler = "com.github.spullara.mustache.java:compiler:0.9.10"
com-google-api-client-google-api-client = "com.google.api-client:google-api-client:1.33.2"
com-google-apis-google-api-services-admin-directory = "com.google.apis:google-api-services-admin-directory:directory_v1-rev20220208-1.32.1"
com-google-apis-google-api-services-groupssettings = "com.google.apis:google-api-services-groupssettings:v1-rev20210624-1.32.1"
com-google-auth-google-auth-library-credentials = { module = "com.google.auth:google-auth-library-credentials", version.ref = "com-google-auth" }
com-google-auth-google-auth-library-oauth2-http = { module = "com.google.auth:google-auth-library-oauth2-http", version.ref = "com-google-auth" }
com-google-guava = "com.google.guava:guava:31.1-jre"
com-google-oauth-client-google-oauth-client-jetty = "com.google.oauth-client:google-oauth-client-jetty:1.33.1"
com-googlecode-cqengine = "com.googlecode.cqengine:cqengine:3.6.0"
com-hazelcast-hazelcast-all = "com.hazelcast:hazelcast-all:4.2.4"
com-hazelcast-hazelcast-kubernetes = "com.hazelcast:hazelcast-kubernetes:2.2.3"
com-oracle-database-jdbc-ojdbc8 = "com.oracle.database.jdbc:ojdbc8:21.5.0.0"
com-oracle-ojdbc-ojdbc8 = "com.oracle.ojdbc:ojdbc8:19.3.0.0"
com-rabbitmq-amqp-client = "com.rabbitmq:amqp-client:5.14.2"
com-sksamuel-hoplite-hoplite-core = { module = "com.sksamuel.hoplite:hoplite-core", version.ref = "com-sksamuel-hoplite" }
com-sksamuel-hoplite-hoplite-hocon = { module = "com.sksamuel.hoplite:hoplite-hocon", version.ref = "com-sksamuel-hoplite" }
com-squareup-okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "com-squareup-okhttp3" }
com-squareup-okhttp3-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "com-squareup-okhttp3" }
com-squareup-retrofit2-converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "com-squareup-retrofit2" }
com-squareup-retrofit2-converter-scalars = { module = "com.squareup.retrofit2:converter-scalars", version.ref = "com-squareup-retrofit2" }
com-squareup-retrofit2-retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "com-squareup-retrofit2" }
com-squareup-sqldelight-coroutines-extensions = { module = "com.squareup.sqldelight:coroutines-extensions", version.ref = "com-squareup-sqldelight" }
com-squareup-sqldelight-jdbc-driver = { module = "com.squareup.sqldelight:jdbc-driver", version.ref = "com-squareup-sqldelight" }
com-squareup-sqldelight-runtime = { module = "com.squareup.sqldelight:runtime", version.ref = "com-squareup-sqldelight" }
com-squareup-sqldelight-sqlite-driver = { module = "com.squareup.sqldelight:sqlite-driver", version.ref = "com-squareup-sqldelight" }
com-zaxxer-HikariCP = "com.zaxxer:HikariCP:5.0.1"
io-github-resilience4j-resilience4j-kotlin = { module = "io.github.resilience4j:resilience4j-kotlin", version.ref = "io-github-resilience4j" }
io-github-resilience4j-resilience4j-retry = { module = "io.github.resilience4j:resilience4j-retry", version.ref = "io-github-resilience4j" }
io-insert-koin-koin-core = { module = "io.insert-koin:koin-core", version.ref = "io-insert-koin" }
io-insert-koin-koin-ktor = { module = "io.insert-koin:koin-ktor", version.ref = "io-insert-koin" }
io-insert-koin-koin-test = { module = "io.insert-koin:koin-test", version.ref = "io-insert-koin" }
io-micrometer-micrometer-registry-prometheus = "io.micrometer:micrometer-registry-prometheus:1.8.3"
junit = "junit:junit:4.13.2"
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "org-junit-jupiter" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "org-junit-jupiter" }
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
kotlin-scripting-compiler-embeddable = { module = "org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable", version.ref = "kotlin" }
kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
kotlinx-coroutines-core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0"
kotlinx-datetime = "org.jetbrains.kotlinx:kotlinx-datetime:0.3.2"
kotlinx-serialization-json = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2"
ktor-auth = { module = "io.ktor:ktor-auth", version.ref = "ktor" }
ktor-auth-jwt = { module = "io.ktor:ktor-auth-jwt", version.ref = "ktor" }
ktor-client-auth-jvm = { module = "io.ktor:ktor-client-auth-jvm", version.ref = "ktor" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
ktor-client-logging-jvm = { module = "io.ktor:ktor-client-logging-jvm", version.ref = "ktor" }
ktor-client-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" }
ktor-gson = { module = "io.ktor:ktor-gson", version.ref = "ktor" }
ktor-metrics-micrometer = { module = "io.ktor:ktor-metrics-micrometer", version.ref = "ktor" }
ktor-serialization = { module = "io.ktor:ktor-serialization", version.ref = "ktor" }
ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
ktor-server-test-host = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" }
net-niebes-retrofit-resilience4j-retry = "net.niebes:retrofit-resilience4j-retry:1.13.0"
org-antlr-antlr4 = { module = "org.antlr:antlr4", version.ref = "org-antlr" }
org-antlr-antlr4-runtime = { module = "org.antlr:antlr4-runtime", version.ref = "org-antlr" }
org-postgresql = "org.postgresql:postgresql:42.3.3"
org-roaringbitmap-RoaringBitmap = "org.roaringbitmap:RoaringBitmap:0.9.25"
org-sql2o = "org.sql2o:sql2o:1.6.0"
org-testcontainers-selenium = "org.testcontainers:selenium:1.16.3"
org-xerial-sqlite-jdbc = "org.xerial:sqlite-jdbc:3.36.0.3"

[plugins]
com-github-ben-manes-versions = "com.github.ben-manes.versions:0.42.0"
com-github-johnrengelman-shadow = "com.github.johnrengelman.shadow:7.1.2"
com-google-cloud-tools-jib = "com.google.cloud.tools.jib:3.2.0"
com-moowork-node = "com.moowork.node:1.3.1"
com-squareup-sqldelight-gradle-plugin = "com.squareup.sqldelight:1.5.3"
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" }
kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-multiplatform-pm20 = { id = "org.jetbrains.kotlin.multiplatform.pm20", version.ref = "kotlin" }
kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
kotlin-native-performance = { id = "org.jetbrains.kotlin.native.performance", version.ref = "kotlin" }
kotlin-platform-android = { id = "org.jetbrains.kotlin.platform.android", version.ref = "kotlin" }
kotlin-platform-common = { id = "org.jetbrains.kotlin.platform.common", version.ref = "kotlin" }
kotlin-platform-js = { id = "org.jetbrains.kotlin.platform.js", version.ref = "kotlin" }
kotlin-platform-jvm = { id = "org.jetbrains.kotlin.platform.jvm", version.ref = "kotlin" }
kotlin-plugin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", version.ref = "kotlin" }
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
nl-littlerobots-version-catalog-update = "nl.littlerobots.version-catalog-update:0.3.1"
org-jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "kotlin" }

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hvissercommented, Mar 30, 2022

I’m currently not sure on how it would fit this plugin and/or how it would complicate things so I’d have to think about having that as a feature. I’d think that a library TOML file that you publish is more carefully curated than the use case of running the update on a project and testing that everything works. For normal projects syncing from TOML to the project doesn’t make much sense to me at the moment, as you’d miss out on unused dependencies and such.

As for the scripting, there is an API for the version catalog itself but I haven’t fully explored it so I can’t really give you more pointers on that…From the looks of it that API should have enough to create the dependency declarations.

0reactions
josearcommented, Mar 30, 2022

Thanks for your comment Hugo. The difference would the source of the versions, right? Currently the plugin gets the versions from de dependency configuration (using the versions plugin), a new feature would be to get the versions from the toml file. I don’t know the gradle plugin system but I would think about learning about it and sending a PR if you think this would be a nice feature (or maybe as a separate plugin?).

I tried to add automatically the dependencies from the version catalog but I didn’t find an accessor to iterate, can you give me some pointer?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven dependency not getting updated with LATEST version
First Please use mvn command line like mvn compile to find the problem. · Set the version to 1.0.0-SNAPSHOT not Latest, if you...
Read more >
Project dependencies not updated on Get latest
Project dependencies are not updated when performing Get latest version of the whole solution and new projects are downloaded from the source control....
Read more >
2020.3.1 and 2020.3.2 doesn't update the dependencies after ...
Dependency in the .iml has not been updated to the new version. Project Structure -> Project Settings -> Libraries still lists the 1.0.0...
Read more >
Path Dependencies not updating the project's dependencies
I am trying to install a packing from a path/directory using poetry. I can install the package and its dependencies fine the first...
Read more >
tfs - Maven dependencies are not getting updated after taking ...
First, you can try force updating the Project by using the option in Eclipse. Right click on the Project > Maven > Update...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found