Skip to content

Commit 2f11e63

Browse files
authored
publish junit 5 compatibility coordinates as maven relocations (fixes #1279, via #1280)
1 parent af70ed2 commit 2f11e63

5 files changed

Lines changed: 77 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
- 🚀 Documentation — https://allurereport.org/docs/junit5/
4343
- 📚 Example project — https://github.com/allure-examples?q=topic%3Ajunit5
4444
- ✅ Generate a project in 10 seconds via Allure Start - https://allurereport.org/start/
45-
- 🧩 Use `io.qameta.allure:allure-jupiter` for new setups. `allure-junit5` remains available as a deprecated compatibility alias during migration.
45+
- 🧩 Use `io.qameta.allure:allure-jupiter` for new setups. `allure-junit5` remains available as a deprecated relocation coordinate during migration.
4646

4747
## Cucumber JVM
4848

allure-jupiter-assert/README.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Adding Jupiter assert may lead to java.lang.OutOfMemoryError: Java heap space
22

3-
The primary artifact is now `allure-jupiter-assert`. `allure-junit5-assert` remains available as a deprecated compatibility alias during the transition.
3+
The primary artifact is now `allure-jupiter-assert`. `allure-junit5-assert` remains available as a deprecated relocation coordinate during the transition.
44

55
Having a huge class path may lead to OOM, because AspectJ processes all the classes. [Link to documentation](https://www.eclipse.org/aspectj/doc/released/devguide/ltw.html)
66

allure-jupiter-assert/build.gradle.kts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@ publishing {
2828
publications {
2929
create<MavenPublication>("legacyJunit5Assert") {
3030
artifactId = "allure-junit5-assert"
31+
pom {
32+
packaging = "pom"
33+
distributionManagement {
34+
relocation {
35+
groupId.set(project.group.toString())
36+
artifactId.set("allure-jupiter-assert")
37+
version.set(project.version.toString())
38+
message.set("allure-junit5-assert has been renamed to allure-jupiter-assert.")
39+
}
40+
}
41+
}
3142
}
3243
}
3344
}

allure-jupiter/build.gradle.kts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,17 @@ publishing {
4545
}
4646
create<MavenPublication>("legacyJunit5") {
4747
artifactId = "allure-junit5"
48-
artifact(spiOffJar)
48+
pom {
49+
packaging = "pom"
50+
distributionManagement {
51+
relocation {
52+
groupId.set(project.group.toString())
53+
artifactId.set("allure-jupiter")
54+
version.set(project.version.toString())
55+
message.set("allure-junit5 has been renamed to allure-jupiter.")
56+
}
57+
}
58+
}
4959
}
5060
}
5161
}

build.gradle.kts

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,14 +398,18 @@ configure(libs) {
398398
}
399399

400400
configure(standardJavaLibs) {
401-
publishing.publications.withType<MavenPublication>().configureEach {
401+
publishing.publications.named<MavenPublication>("maven") {
402402
from(components["java"])
403403
}
404404
}
405405

406406
val verifyJupiterCompatibilityBridge by tasks.registering {
407407
dependsOn(
408-
":allure-bom:generatePomFileForMavenPublication"
408+
":allure-bom:generatePomFileForMavenPublication",
409+
":allure-jupiter:generatePomFileForMavenPublication",
410+
":allure-jupiter:generatePomFileForLegacyJunit5Publication",
411+
":allure-jupiter-assert:generatePomFileForMavenPublication",
412+
":allure-jupiter-assert:generatePomFileForLegacyJunit5AssertPublication"
409413
)
410414

411415
doLast {
@@ -422,15 +426,15 @@ val verifyJupiterCompatibilityBridge by tasks.registering {
422426
"Expected :allure-jupiter to publish the primary allure-jupiter coordinate."
423427
}
424428
check("allure-junit5" in jupiterArtifactIds) {
425-
"Expected :allure-jupiter to publish the legacy allure-junit5 alias."
429+
"Expected :allure-jupiter to publish the legacy allure-junit5 relocation."
426430
}
427431

428432
val jupiterAssertArtifactIds = publicationArtifactIds(":allure-jupiter-assert")
429433
check("allure-jupiter-assert" in jupiterAssertArtifactIds) {
430434
"Expected :allure-jupiter-assert to publish the primary allure-jupiter-assert coordinate."
431435
}
432436
check("allure-junit5-assert" in jupiterAssertArtifactIds) {
433-
"Expected :allure-jupiter-assert to publish the legacy allure-junit5-assert alias."
437+
"Expected :allure-jupiter-assert to publish the legacy allure-junit5-assert relocation."
434438
}
435439

436440
val bomPom = project(":allure-bom")
@@ -441,17 +445,60 @@ val verifyJupiterCompatibilityBridge by tasks.registering {
441445
.asFile
442446
.readText()
443447

448+
fun publicationPom(projectPath: String, publicationName: String): String =
449+
project(projectPath)
450+
.layout
451+
.buildDirectory
452+
.file("publications/$publicationName/pom-default.xml")
453+
.get()
454+
.asFile
455+
.readText()
456+
444457
check("<artifactId>allure-jupiter</artifactId>" in bomPom) {
445458
"Expected allure-bom to manage allure-jupiter."
446459
}
447460
check("<artifactId>allure-junit5</artifactId>" in bomPom) {
448-
"Expected allure-bom to manage the legacy allure-junit5 alias."
461+
"Expected allure-bom to manage the legacy allure-junit5 relocation."
449462
}
450463
check("<artifactId>allure-jupiter-assert</artifactId>" in bomPom) {
451464
"Expected allure-bom to manage allure-jupiter-assert."
452465
}
453466
check("<artifactId>allure-junit5-assert</artifactId>" in bomPom) {
454-
"Expected allure-bom to manage the legacy allure-junit5-assert alias."
467+
"Expected allure-bom to manage the legacy allure-junit5-assert relocation."
468+
}
469+
470+
val legacyJunit5Pom = publicationPom(":allure-jupiter", "legacyJunit5")
471+
check("<artifactId>allure-junit5</artifactId>" in legacyJunit5Pom) {
472+
"Expected the legacy allure-junit5 publication to keep the old artifact id."
473+
}
474+
check("<relocation>" in legacyJunit5Pom) {
475+
"Expected the legacy allure-junit5 publication to be a relocation POM."
476+
}
477+
check("<packaging>pom</packaging>" in legacyJunit5Pom) {
478+
"Expected the legacy allure-junit5 relocation to use pom packaging."
479+
}
480+
check("<dependencies>" !in legacyJunit5Pom) {
481+
"Expected the legacy allure-junit5 relocation POM to avoid publishing dependencies."
482+
}
483+
check("<artifactId>allure-jupiter</artifactId>" in legacyJunit5Pom) {
484+
"Expected the legacy allure-junit5 publication to relocate to allure-jupiter."
485+
}
486+
487+
val legacyJunit5AssertPom = publicationPom(":allure-jupiter-assert", "legacyJunit5Assert")
488+
check("<artifactId>allure-junit5-assert</artifactId>" in legacyJunit5AssertPom) {
489+
"Expected the legacy allure-junit5-assert publication to keep the old artifact id."
490+
}
491+
check("<relocation>" in legacyJunit5AssertPom) {
492+
"Expected the legacy allure-junit5-assert publication to be a relocation POM."
493+
}
494+
check("<packaging>pom</packaging>" in legacyJunit5AssertPom) {
495+
"Expected the legacy allure-junit5-assert relocation to use pom packaging."
496+
}
497+
check("<dependencies>" !in legacyJunit5AssertPom) {
498+
"Expected the legacy allure-junit5-assert relocation POM to avoid publishing dependencies."
499+
}
500+
check("<artifactId>allure-jupiter-assert</artifactId>" in legacyJunit5AssertPom) {
501+
"Expected the legacy allure-junit5-assert publication to relocate to allure-jupiter-assert."
455502
}
456503
}
457504
}

0 commit comments

Comments
 (0)