Ram :
I created a brand new (Gradle, Java Language, Boot 2.2.6, Jar & Java 11) project in start.spring.io (no dependencies specified). I expected to see vanilla JUnit (junit:junit:x.xx
) dependency in the testing classpath. But do not find it.
Executing ./gradlew dependencies
does not include the vanilla JUnit but only org.junit.jupiter:junit-jupiter
. Please see the relevant output below.
The default generated test (DemoApplicationTests.java
) only has an import org.junit.jupiter.api.Test;
instead of import org.junit.Test
.
What am I missing? The complete build.gradle is included below for easy reference.
Relevant portion of ./gradlew dependencies
:
\--- org.springframework.boot:spring-boot-starter-test -> 2.2.6.RELEASE
+--- org.springframework.boot:spring-boot-starter:2.2.6.RELEASE (*)
+--- org.springframework.boot:spring-boot-test:2.2.6.RELEASE
| \--- org.springframework.boot:spring-boot:2.2.6.RELEASE (*)
+--- org.springframework.boot:spring-boot-test-autoconfigure:2.2.6.RELEASE
| +--- org.springframework.boot:spring-boot-test:2.2.6.RELEASE (*)
| \--- org.springframework.boot:spring-boot-autoconfigure:2.2.6.RELEASE (*)
+--- com.jayway.jsonpath:json-path:2.4.0
| +--- net.minidev:json-smart:2.3
| | \--- net.minidev:accessors-smart:1.2
| | \--- org.ow2.asm:asm:5.0.4
| \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
+--- jakarta.xml.bind:jakarta.xml.bind-api:2.3.3
| \--- jakarta.activation:jakarta.activation-api:1.2.2
+--- org.junit.jupiter:junit-jupiter:5.5.2
| +--- org.junit.jupiter:junit-jupiter-api:5.5.2
| | +--- org.apiguardian:apiguardian-api:1.1.0
| | +--- org.opentest4j:opentest4j:1.2.0
| | \--- org.junit.platform:junit-platform-commons:1.5.2
| | \--- org.apiguardian:apiguardian-api:1.1.0
| +--- org.junit.jupiter:junit-jupiter-params:5.5.2
| | +--- org.apiguardian:apiguardian-api:1.1.0
| | \--- org.junit.jupiter:junit-jupiter-api:5.5.2 (*)
| \--- org.junit.jupiter:junit-jupiter-engine:5.5.2
| +--- org.apiguardian:apiguardian-api:1.1.0
| +--- org.junit.platform:junit-platform-engine:1.5.2
| | +--- org.apiguardian:apiguardian-api:1.1.0
| | +--- org.opentest4j:opentest4j:1.2.0
| | \--- org.junit.platform:junit-platform-commons:1.5.2 (*)
| \--- org.junit.jupiter:junit-jupiter-api:5.5.2 (*)
+--- org.mockito:mockito-junit-jupiter:3.1.0
| +--- org.mockito:mockito-core:3.1.0
| | +--- net.bytebuddy:byte-buddy:1.9.10 -> 1.10.8
| | +--- net.bytebuddy:byte-buddy-agent:1.9.10 -> 1.10.8
| | \--- org.objenesis:objenesis:2.6
| \--- org.junit.jupiter:junit-jupiter-api:5.4.2 -> 5.5.2 (*)
+--- org.assertj:assertj-core:3.13.2
+--- org.hamcrest:hamcrest:2.1
+--- org.mockito:mockito-core:3.1.0 (*)
+--- org.skyscreamer:jsonassert:1.5.0
| \--- com.vaadin.external.google:android-json:0.0.20131108.vaadin1
+--- org.springframework:spring-core:5.2.5.RELEASE (*)
+--- org.springframework:spring-test:5.2.5.RELEASE
| \--- org.springframework:spring-core:5.2.5.RELEASE (*)
\--- org.xmlunit:xmlunit-core:2.6.4
Complete build.gradle
plugins {
id 'org.springframework.boot' version '2.2.6.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
Thomas Kläger :
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=356295&siteId=1