diff --git a/junit5-jupiter-extensions/build.gradle b/junit5-jupiter-extensions/build.gradle
index 545bfcdb..d527fc38 100644
--- a/junit5-jupiter-extensions/build.gradle
+++ b/junit5-jupiter-extensions/build.gradle
@@ -1,5 +1,5 @@
plugins {
- id 'java'
+ id 'java-library'
id 'eclipse' // optional (to generate Eclipse project files)
id 'idea' // optional (to generate IntelliJ IDEA project files)
}
@@ -17,10 +17,10 @@ tasks.withType(JavaCompile) {
}
dependencies {
- compile("org.junit.jupiter:junit-jupiter-api:5.4.2") {
+ api("org.junit.jupiter:junit-jupiter-api:5.4.2") {
because 'building extensions in "main" using JUnit Jupiter API'
}
- testRuntime("org.junit.jupiter:junit-jupiter-engine:5.4.2") {
+ testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.4.2") {
because 'at least one engine is needed at test runtime'
}
}
diff --git a/junit5-jupiter-starter-gradle-groovy/build.gradle b/junit5-jupiter-starter-gradle-groovy/build.gradle
index 50e9b96c..43bb658f 100644
--- a/junit5-jupiter-starter-gradle-groovy/build.gradle
+++ b/junit5-jupiter-starter-gradle-groovy/build.gradle
@@ -9,7 +9,7 @@ repositories {
}
dependencies {
- compile localGroovy()
+ implementation(localGroovy())
testImplementation('org.junit.jupiter:junit-jupiter:5.4.2')
}
diff --git a/junit5-migration-gradle/README.md b/junit5-migration-gradle/README.md
index a8976fe9..31153e1a 100644
--- a/junit5-migration-gradle/README.md
+++ b/junit5-migration-gradle/README.md
@@ -26,14 +26,14 @@ Optionally, you can configure the `test` task as follows.
```groovy
test {
useJUnitPlatform {
- // includeEngines 'junit-jupiter', 'junit-vintage'
- // excludeEngines 'custom-engine'
+ // includeEngines("junit-jupiter", "junit-vintage")
+ // excludeEngines("custom-engine")
- // includeTags 'fast'
- excludeTags 'slow'
+ // includeTags("fast")
+ excludeTags("slow")
}
testLogging {
- events 'passed', 'skipped', 'failed'
+ events("passed", "skipped", "failed")
}
}
```
@@ -53,25 +53,25 @@ Gradle will not run tests that are _tagged_ accordingly.
In order to have Gradle's `test` task run any tests at all, a `TestEngine`
implementation must be on the classpath.
-To configure support for JUnit Jupiter based tests, configure a `testCompile` dependency
-on the JUnit Jupiter API and a `testRuntime` dependency on the JUnit Jupiter TestEngine
-implementation similar to the following.
+To configure support for JUnit Jupiter based tests, configure a `testImplementation`
+dependency on the `junit-jupiter` artifact. That will cause `testImplementation`
+dependency on the JUnit Jupiter API and a `testRuntimeOnly` dependency on the JUnit
+Jupiter TestEngine.
```groovy
dependencies {
- testCompile("org.junit.jupiter:junit-jupiter-api:5.4.2")
- testRuntime("org.junit.jupiter:junit-jupiter-engine:5.4.2")
+ testImplementation("org.junit.jupiter:junit-jupiter:5.4.2")
}
```
Gradle can also run JUnit 3 and JUnit 4 based tests as long as you
-configure a `testCompile` dependency on JUnit 4 and a `testRuntime` dependency on the
-JUnit Vintage TestEngine implementation similar to the following.
+configure a `testImplementation` dependency on JUnit 4 and a `testRuntimeOnly` dependency
+on the JUnit Vintage TestEngine implementation similar to the following.
```groovy
dependencies {
- testCompile("junit:junit:4.12")
- testRuntime("org.junit.vintage:junit-vintage-engine:5.4.2")
+ testImplementation("junit:junit:4.12")
+ testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.4.2")
}
```
diff --git a/junit5-migration-gradle/build.gradle b/junit5-migration-gradle/build.gradle
index b558fafb..dad79c7d 100644
--- a/junit5-migration-gradle/build.gradle
+++ b/junit5-migration-gradle/build.gradle
@@ -24,12 +24,12 @@ dependencies {
// JUnit Jupiter API and TestEngine implementation
testImplementation("org.junit.jupiter:junit-jupiter")
- testCompile("junit:junit:${junit4Version}")
- testRuntime("org.junit.vintage:junit-vintage-engine") {
+ testImplementation("junit:junit:${junit4Version}")
+ testRuntimeOnly("org.junit.vintage:junit-vintage-engine") {
because 'allows JUnit 3 and JUnit 4 tests to run'
}
- testRuntime("org.junit.platform:junit-platform-launcher") {
+ testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because 'allows tests to run from IDEs that bundle older version of launcher'
}
}
diff --git a/junit5-migration-maven/pom.xml b/junit5-migration-maven/pom.xml
index ba20fe98..d267c36d 100644
--- a/junit5-migration-maven/pom.xml
+++ b/junit5-migration-maven/pom.xml
@@ -35,11 +35,13 @@
org.junit.jupiter
junit-jupiter-engine
${junit.jupiter.version}
+ test
org.junit.vintage
junit-vintage-engine
${junit.vintage.version}
+ test