Published gradle subproject depending on other subproject tries to resolve subproject to publication

39 views Asked by At

I have the following gradle project structure:

repo:

  • library
  • sharedlibrary

where library and sharedlibrary are subprojects

library depends on sharedlibrary library publishes to githubpackages using the following publishing configuration in build.gradle.kts

plugins {
    kotlin("jvm")
    `maven-publish`
    id("com.github.johnrengelman.shadow")
}

publishing {
    repositories {
        maven {
            name = "GitHubPackages"
            url = uri("https://maven.pkg.github.com/some-repo")
            credentials {
                username = "some-username"
                password = "some-password"
            }
        }
    }

    publications {
        register<MavenPublication>("my-library") {
            artifactId = "my-library"
            from(components["java"])
        }
    }
}

tasks {
    shadowJar {
        archiveClassifier.set("")
        archiveExtension.set("jar")
        minimize()
    }
}

java {
    withJavadocJar()
    withSourcesJar()
}

group = "some.group"
version = "0.1"

dependencies {
  implementation(project(":sharedlibrary"))
  ...
}

When dependeding on my-library in another project I get the following error

Could not resolve repo:sharedlibrary:0.1

removing th shadowJar configuration or the plugin entirely still results in the same behaviour.

Is the shadowJar configuration wrong or am I missing something else?

0

There are 0 answers