Maven发布gradle插件跳过版本

我有gradle多模块项目配置kotlin脚本。 我想添加发布到Maven仓库,我发现它的maven-publish插件。 但它似乎跳过了为每个项目配置的版本:

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输出:

 test: my.project subproject1 unspecified artifact file does not exist: '.../MyProject/subproject1/build/libs/subproject1.jar' 

文件subproject1.jar不存在,但subproject1-1.0.0-SNAPSHOT.jar会。 如何使gradle得到正确版本的模块?

Kotlin language will be the best programming language for Android.