diff --git a/plugin/src/main/kotlin/com/vanniktech/maven/publish/MavenPublishBaseExtension.kt b/plugin/src/main/kotlin/com/vanniktech/maven/publish/MavenPublishBaseExtension.kt index 34d825e3..fe653f12 100644 --- a/plugin/src/main/kotlin/com/vanniktech/maven/publish/MavenPublishBaseExtension.kt +++ b/plugin/src/main/kotlin/com/vanniktech/maven/publish/MavenPublishBaseExtension.kt @@ -23,9 +23,9 @@ abstract class MavenPublishBaseExtension( private val sonatypeHost: Property = project.objects.property(SonatypeHost::class.java) private val signing: Property = project.objects.property(Boolean::class.java) - private val groupId: Property = project.objects.property(String::class.java) + internal val groupId: Property = project.objects.property(String::class.java) .convention(project.provider { project.group.toString() }) - private val version: Property = project.objects.property(String::class.java) + internal val version: Property = project.objects.property(String::class.java) .convention(project.provider { project.version.toString() }) private val pomFromProperties: Property = project.objects.property(Boolean::class.java) private val platform: Property = project.objects.property(Platform::class.java) diff --git a/plugin/src/main/kotlin/com/vanniktech/maven/publish/Platform.kt b/plugin/src/main/kotlin/com/vanniktech/maven/publish/Platform.kt index 3134f4d3..306a0632 100644 --- a/plugin/src/main/kotlin/com/vanniktech/maven/publish/Platform.kt +++ b/plugin/src/main/kotlin/com/vanniktech/maven/publish/Platform.kt @@ -440,6 +440,14 @@ private fun setupTestFixtures(project: Project, sourcesJar: Boolean) { it.suppressPomMetadataWarningsFor("testFixturesRuntimeElements") it.suppressPomMetadataWarningsFor("testFixturesSourcesElements") } + + project.afterEvaluate { + // Gradle will put the project group and version into capabilities instead of using + // the publication, this can lead to invalid published metadata + // TODO remove after https://github.com/gradle/gradle/issues/23354 is resolved + project.group = project.baseExtension.groupId.get() + project.version = project.baseExtension.version.get() + } } }