You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I hurt my head while migrating from groovy to kotlin, my project with submodules. But I found that the problem is here even with a simple project.
The problem is in gradle 7.5 and 8.10 with the testFixtures plugin.
Here is my build.gradle.kts
val gitlabMavenUrl: String by project
val gitlabMavenToken: String by project
group = "com.test"
extra["xmlunit2.version"] = "2.10.0" // Spring boot depends on 2.9.0 -> CVE-2024-31573
plugins {
idea
java
kotlin("jvm") version libs.versions.kotlin
kotlin("kapt") version libs.versions.kotlin
id("java-library")
id("maven-publish")
id("java-test-fixtures")
}
kotlin {
jvmToolchain(21)
}
dependencies {
// Testing : Junit
testImplementation(platform("org.junit:junit-bom:5.11.2"))
testImplementation("org.junit.jupiter:junit-jupiter-api")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.jar {
from(sourceSets.main.get().allSource)
from(sourceSets.testFixtures.get().allSource)
}
java {
withJavadocJar()
withSourcesJar()
}
tasks.javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
publishing {
repositories {
maven {
url = uri(gitlabMavenUrl)
credentials(HttpHeaderCredentials::class) {
name = "Deploy-Token"
value = gitlabMavenToken
}
authentication {
create("header", HttpHeaderAuthentication::class)
}
}
}
publications {
create<MavenPublication>("libTest") {
from(components["java"])
artifactId = "lib-test"
}
}
}
sourceSets {
main {
java {
srcDir("${layout.buildDirectory}/generated/source/kapt/main")
}
}
}
This is unfortunately an issue in Gradle gradle/gradle#23354. Since there isn't much movement on that issue we should add a warning or error to the plugin in this case. That way at least no one will publish something with broken metadata.
Thank you very much for your very fast answer.
I understand that the workaround is to not modify the publication coordinates in the publication block. However, how to do when there is 2 submodules with publication of differently named artifacts ?
Hi,
I hurt my head while migrating from groovy to kotlin, my project with submodules. But I found that the problem is here even with a simple project.
The problem is in gradle 7.5 and 8.10 with the testFixtures plugin.
Here is my build.gradle.kts
and my settings.grade.kts
The main part here is this, where you can notice that the artifactId is the same as the project name :
That will generate a pom without the self-reference dependency.
However if I change for
Then it adds in the POM this :
That is strange as this problem appears only with kts and not groovy.
And as said in introduction, I have submodules, with 2 libs to publish so with different artifacts names than the project name.
Did I miss something or is it a bug ?
Thank you,
The text was updated successfully, but these errors were encountered: