From 397a4237725fe21dc6cee6856a16387ae6b560ab Mon Sep 17 00:00:00 2001 From: jakobjuelich Date: Tue, 11 Jan 2022 01:18:07 +0100 Subject: [PATCH] Suggest putting jupiter on runtime only (#2021) Suggest putting jupiter on runtime only in error --- changelog/@unreleased/pr-2021.v2.yml | 6 ++++++ .../com/palantir/baseline/tasks/CheckJUnitDependencies.java | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 changelog/@unreleased/pr-2021.v2.yml diff --git a/changelog/@unreleased/pr-2021.v2.yml b/changelog/@unreleased/pr-2021.v2.yml new file mode 100644 index 000000000..ad21243e6 --- /dev/null +++ b/changelog/@unreleased/pr-2021.v2.yml @@ -0,0 +1,6 @@ +type: improvement +improvement: + description: Upon missing jupiter on classpath, suggest putting it on runtime rather + than implementation to avoid making checkUnusedDependenciesTest fail in return. + links: + - https://github.com/palantir/gradle-baseline/pull/2021 diff --git a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/tasks/CheckJUnitDependencies.java b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/tasks/CheckJUnitDependencies.java index 9e7018061..905ae24a8 100644 --- a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/tasks/CheckJUnitDependencies.java +++ b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/tasks/CheckJUnitDependencies.java @@ -93,7 +93,7 @@ private void validateSourceSet(SourceSet ss, Test task) { // org.junit.jupiter.api.Test annotation, but as JUnit4 knows nothing about these, they'll silently not run // unless the user has wired up the dependency correctly. if (sourceSetMentionsJUnit5Api(ss)) { - String implementation = ss.getImplementationConfigurationName(); + String runtime = ss.getRuntimeClasspathConfigurationName(); Preconditions.checkState( junitPlatformEnabled, "Some tests mention JUnit5, but the '" @@ -102,7 +102,7 @@ private void validateSourceSet(SourceSet ss, Test task) { + "useJUnitPlatform() enabled. This means tests may be silently not running! Please " + "add the following:\n\n" + " " - + implementation + + runtime + " 'org.junit.jupiter:junit-jupiter'\n"); }