I'm trying to publish my version catalogs to maven...
# gradle
r
I'm trying to publish my version catalogs to maven but my
libs.toml
file isn't getting uploaded. Is there anything i'm missing. Here is my publish script.
Copy code
publishing {
    publications {
        create<MavenPublication>("maven") {
            artifactId = rootProject.name
            from(components.getByName("versionCatalog"))

            pom {
                name.set("versions")
                description.set(project.description)
                url.set("https:/example.com")
            }
        }
    }
}
j
Are you applying the version catalog plugin?
r
I am. This is my complete
build.gradle.kts
file
Copy code
plugins {
    `kotlin-dsl`
    `version-catalog`
    `maven-publish`
}

group = "com.foreverrafs"
version = "0.0.3"

publishing {
    publications {
        create<MavenPublication>("maven") {
            artifactId = rootProject.name
            from(components.getByName("versionCatalog"))

            pom {
                name.set("versions")
                description.set(project.description)
                url.set("<https://www.google.com/>")
            }
        }
    }
}

catalog {
    versionCatalog {
        from(files("gradle/libs.versions.toml"))
    }
}
j
on my code the only difference I see is I am using
withType<MavenPublication>().configureEach {
instead of creating a publication
r
Do you mind sharing all your config
a
just to double check,
files("gradle/libs.versions.toml")
is returning a single file, right? If you put
Copy code
println(files("gradle/libs.versions.toml"))
it’s picking up the file correctly?
r
Yeah it's picking up the file correctly @Adam S
I have it here, in case you want to take a look https://github.com/rafsanjani/version-catalogs
a
what happens if you publish it to Maven Local?
r
If i publish to Maven Local, it works correctly
I'm able to use it in other projects
j
My config is not easy to follow as I use a convention plugin with a dsl which allows publishing a lot of things, any way it is open source on GitHub, https://github.com/JavierSegoviaCordoba/hubdle
a
my guess is that the server you’re publishing it to has got some sort of config that rejects .toml files. Or something similar, like Gradle isn’t generating checksums for the .toml file, and that’s why it’s rejected
r
I've only tried publishing and accessing it from jitpack
In the logs from Jitpack, I can clearly see the toml file isn't published
j
if it works on mavenLocal then the problem is jitpack
r
Okay, I will try publishing it to somewhere else and see
v
Yeah, well, if in doubt always first blame JitPack and try some sane repository.
It is broken by design and unreliable and slow and also breaks various things like rewriting metadata files in a way the often breaks and so on. Don't use it for any sane publishing, but at most for experimenting with stuff. But better publish proper snapshot versions to a snapshot repository.
It could well be that it does not handle published toml files if that really is what Gradle does.
Btw. have a look at the channel topic. 😉
342 Views