Skip to content

Commit c7e1489

Browse files
Add custom dependency resolution to JUnit5 avoiding prereleases (#10167)
1 parent 015be6d commit c7e1489

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

dd-java-agent/instrumentation/junit/junit-5.3/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ configurations.matching { it.name.startsWith('test') }.configureEach {
6565
}
6666
}
6767

68+
// Reject RC (Release Candidate) and M (Milestone) versions for latest5Test and latestDepTest configurations
69+
configurations.matching { it.name.startsWith('latest5Test') || it.name.startsWith('latestDepTest') }.configureEach {
70+
it.resolutionStrategy.componentSelection.all { ComponentSelection selection ->
71+
def version = selection.candidate.version
72+
if ((selection.candidate.group == 'org.junit.platform' || selection.candidate.group == 'org.junit.jupiter') &&
73+
(version.matches('.*-RC.*') || version.matches('.*-M\\d+.*'))) {
74+
selection.reject("Skipping pre-release version: ${version}")
75+
}
76+
}
77+
}
78+
6879
tasks.named("compileLatestDepTestJava", JavaCompile) {
6980
configureCompiler(it, 17, JavaVersion.VERSION_1_8)
7081
}

dd-java-agent/instrumentation/junit/junit-5.3/junit-5.8/build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ configurations.matching { it.name.startsWith('test') }.configureEach {
5757
}
5858
}
5959

60+
// Reject RC (Release Candidate) and M (Milestone) versions for latestDepTest configurations
61+
configurations.matching { it.name.startsWith('latestDepTest') }.configureEach {
62+
it.resolutionStrategy.componentSelection.all { ComponentSelection selection ->
63+
def version = selection.candidate.version
64+
if ((selection.candidate.group == 'org.junit.platform' || selection.candidate.group == 'org.junit.jupiter') &&
65+
(version.matches('.*-RC.*') || version.matches('.*-M\\d+.*'))) {
66+
selection.reject("Skipping pre-release version: ${version}")
67+
}
68+
}
69+
}
70+
6071
tasks.named("compileLatestDepTestJava", JavaCompile) {
6172
configureCompiler(it, 17, JavaVersion.VERSION_1_8)
6273
}

0 commit comments

Comments
 (0)