Reputation: 838
I couldn't find which jar will provide me the dependency of SpringRunner.class
I am trying to upgrade my Integration tests to spring-boot 1.4.0
Upvotes: 3
Views: 26197
Reputation: 522
If someone else reads and has the same problem, I solved the dependency by removing <scope>test<scope>
from spring-boot-starter-test. Indeed, that parameter tells that the dependency is not used at compile time, but only during testing; however, it's not our case.
Here is the new snippet from the pom:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.1.4.RELEASE</version>
P.S. I additionally matched the version of spring-boot-starter-test with spring-boot-starter-parent.
Upvotes: 2
Reputation: 1
upgrade spring-boot-starter-parent to 2.0.1.RELEASE
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
Upvotes: 0
Reputation: 11
Download the Spring-test jar and add it manually to the build path by adding external jars. It resolved all the problem for me.
::Download jar from here: https://mvnrepository.com/artifact/org.springframework/spring-test/2.5
Upvotes: 0
Reputation: 31
Try manually adding this import:
import org.springframework.test.context.junit4.SpringRunner;
Upvotes: 3
Reputation: 47971
SpringRunner.java
is located in the spring-test-4.3.2.RELEASE.jar
file.
In order to use it in a Maven or Gradle project, you should declare a dependency on org.springframework.boot:spring-boot-starter-test
.
Here are the libraries that org.springframework.boot:spring-boot-starter-test
depends on:
+--- org.springframework.boot:spring-boot-starter-test: -> 1.4.0.RELEASE
| +--- org.springframework.boot:spring-boot-test:1.4.0.RELEASE
| | \--- org.springframework.boot:spring-boot:1.4.0.RELEASE (*)
| +--- org.springframework.boot:spring-boot-test-autoconfigure:1.4.0.RELEASE
| | +--- org.springframework.boot:spring-boot-test:1.4.0.RELEASE (*)
| | \--- org.springframework.boot:spring-boot-autoconfigure:1.4.0.RELEASE (*)
| +--- com.jayway.jsonpath:json-path:2.2.0
| | +--- net.minidev:json-smart:2.2.1
| | | \--- net.minidev:accessors-smart:1.1
| | | \--- org.ow2.asm:asm:5.0.3
| | \--- org.slf4j:slf4j-api:1.7.16 -> 1.7.19
| +--- junit:junit:4.12
| | \--- org.hamcrest:hamcrest-core:1.3
| +--- org.assertj:assertj-core:2.5.0 -> 2.4.1
| +--- org.mockito:mockito-core:1.10.19
| | +--- org.hamcrest:hamcrest-core:1.1 -> 1.3
| | \--- org.objenesis:objenesis:2.1 -> 2.2
| +--- org.hamcrest:hamcrest-core:1.3
| +--- org.hamcrest:hamcrest-library:1.3
| | \--- org.hamcrest:hamcrest-core:1.3
| +--- org.skyscreamer:jsonassert:1.3.0
| | \--- org.json:json:20090211 -> 20140107
| +--- org.springframework:spring-core:4.3.2.RELEASE
| \--- org.springframework:spring-test:4.3.2.RELEASE
| \--- org.springframework:spring-core:4.3.2.RELEASE
Upvotes: 6
Reputation: 15327
Use following maven dependencies.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Upvotes: 1
Reputation: 1676
You could search for a class in search.maven.org
https://search.maven.org/#search|ga|1|fc%3A%22SpringRunner%22
Upvotes: 1