Skip to content

Strange behavior when publishing SNAPSHOT artifacts in JFrog's Artifactory  #124

@KlaudWerk

Description

@KlaudWerk

How can we help?

I have multi-module Kotlin project with Gradle build (8.4)
Only one module publishes its artifacts.
Here is the module's build.gradle.kts

plugins {
    kotlin("jvm")
    ...
    `maven-publish`
    id("com.jfrog.artifactory") version "5+"
}
publishing {

    publications {
        create<MavenPublication>("maven") {
            from(components["kotlin"])
            artifact(tasks.getByName("sourcesJar")) {
                classifier = "sources"
            }
            artifact(tasks.getByName("javadocJar")) {
                classifier = "javadoc"
            }
        }
    }
}

artifactory {
    setContextUrl("https://..../artifactory")

    publish {
        val repoKey = when ((project.findProperty("release") as? String)?.toBoolean()) {
            true -> "libs-release-local"
            else -> "libs-snapshot-local"
        }
        repository {
            setRepoKey(repoKey)
            setUsername(System.getenv("ARTIFACTORY_USER"))
            setPassword(System.getenv("ARTIFACTORY_PASS"))
        }
        defaults {
            publications("maven")
        }
    }
}

When I execute artifactoryPublish task for the first time, I can see following artifacts in the repository:
-[Folder] 0.0.1-SNAPSHOT
- maven-metadata.xml
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1-javadoc.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1-plain.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1-sources.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1.module
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1.pom

Everything looks all right, the library is available and can be pulled without issues.
Now, when I run the task for the second time, I see this:
-[Folder] 0.0.1-SNAPSHOT
- maven-metadata.xml
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1-javadoc.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1-plain.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1-sources.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1.module
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1.pom
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-2.module
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-2.pom
And of course, the library cannot be pulled
For the third run, I have this:
-[Folder] 0.0.1-SNAPSHOT
- maven-metadata.xml
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1-javadoc.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1-plain.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1-sources.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1.module
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-1.pom
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-2.module
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-2.pom
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-2-javadoc.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-2-plain.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-2-sources.jar
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-3.module
- lib-0.0.1-SNAPSHOT-xxxxx-xxx-3.pom
And it continues. For each run, only module and pom are added.
I spent lots of time digging but didn't find the source of this behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions