Skip to content

Kotlin Mutli Platform Package Bug

Summary

I'm encountering a bug where a maven multi platform package is reporting an incorrect artifactId and version, for kotlin multi platform projects.

<dependency>
  <groupId>design.animus.kotlin.mp.datatypes-metadata</groupId>
  <artifactId>0.1.3-SNAPSHOT</artifactId>
  <version>null</version>
</dependency>

This same setup works properly in SonaType nexus with no modifications. In the above snippet, and in the repos package section. The artifactId is folded into the groupId.

<dependency>
  <groupId>design.animus.kotlin.mp.datatypes-metadata</groupId>
  <artifactId>datatypes-metadata</artifactId>
  <version>0.1.3-SNAPSHOT</version>
</dependency>

I tried explicitly setting the artifact id and version, but it was still ignored by gitlab. I also validated the same config worked against artifactory.

I have several projects that utilize this, but two can be used as demos.

https://gitlab.com/AnimusDesign/kotlin-mp-data-types/-/blob/master/build.gradle.kts#L134-147

https://gitlab.com/AnimusDesign/kotlin-logging/-/blob/dev/linux_x64_native/build.gradle.kts#L131-144

Prior to switching this, where my sona type nexus looked like.

https://gitlab.com/AnimusDesign/kotlin-logging/-/blob/894aa06820747e8d4571667c17df76b11c65a865/build.gradle.kts#L126-139

The kotlin multi platform plugin. Takes the gradle project version, and target source set to make the artifact.

Steps to reproduce

For testing I've switched the gradle kts of either project to.

repositories {
        maven {
            url = URI(extra["artifactUrl"].toString())
            credentials(HttpHeaderCredentials::class) {

                name = "Private-Token"
                value = "$PersonalToken"
            }
            authentication {
                register("header", HttpHeaderAuthentication::class)
            }
       }
    }

Then run

./gradlew publish

Example Project

Noted above

What is the current bug behavior?

  • Version is null
  • artifactId is actually the version.

What is the expected correct behavior?

  • Version should be the version not null
  • artifactId should be the artifact id

Relevant logs and/or screenshots

You can see logs via pipe lines, an example of a publish attempt is

https://gitlab.com/AnimusDesign/kotlin-logging/pipelines/130210951

I did delete all those artifacts while trying to narrow this bug down. I can also enable debug logging.

Output of checks

(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)

Results of GitLab environment info

Cloud instance through GitLab OSS License

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Edited by AnimusNull