I have gradle multi-module project configured with kotlin-script. I'd like to add publishing to maven repository and I found maven-publish
plugin for it. But it seems to skip the version configured for each project:
MyProject/build.gradle.kts
:
subprojects {
apply {
plugin("maven-publish")
}
configure<PublishingExtension>() {
publications {
repositories { ... }
create<MavenPublication>("myPublication") {
from(components.getByName("java"))
logger.lifecycle("test: ${project.group} ${project.name} ${project.version}")
}
}
MyProject/subproject1/build.gradle.kts
:
version = "1.0.0-SNAPSHOT"
gradle publish
output:
test: my.project subproject1 unspecified
artifact file does not exist: '.../MyProject/subproject1/build/libs/subproject1.jar'
File subproject1.jar
doesn't exist, but subproject1-1.0.0-SNAPSHOT.jar
does. How to make gradle get the correct version of module?