When you declare api project(':shared'), Gradle should expose it to consumers, but the default Maven Publish configuration doesn't automatically include these dependencies in the POM. Here's the fix:
Add this to your :library's build.gradle.kts inside the MavenPublication block:
pom {
withXml {
val dependenciesNode = asNode().getAt("dependencies")?.get(0)
?: asNode().appendNode("dependencies")
configurations["releaseApiElements"].allDependencies
.filter { it.group != null && it.name != "unspecified" }
.forEach {
val dependencyNode = dependenciesNode.appendNode("dependency")
dependencyNode.appendNode("groupId", it.group)
dependencyNode.appendNode("artifactId", it.name)
dependencyNode.appendNode("version", it.version)
dependencyNode.appendNode("scope", "compile")
}
}
}
Make sure :shared is also published to the same repository (JitPack). Your project structure requires publishing all modules independently – JitPack will handle building the full dependency tree if all modules are in the same Git repo.