Skip to content

Commit 1351759

Browse files
author
Phillip Webb
committed
Revert "Remove test dependencies from spring-boot-starter-parent"
This reverts commit 5ded496. Fixes gh-628
1 parent 2bb0f74 commit 1351759

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

spring-boot-docs/src/main/asciidoc/getting-started.adoc

+8-3
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ endif::release[]
203203
204204
dependencies {
205205
compile("org.springframework.boot:spring-boot-starter-web")
206-
testCompile("org.springframework.boot:spring-boot-starter-test")
206+
testCompile("junit:junit")
207207
}
208208
----
209209

@@ -478,11 +478,16 @@ currently have.
478478
$ mvn dependency:tree
479479
480480
[INFO] com.example:myproject:jar:0.0.1-SNAPSHOT
481+
[INFO] +- junit:junit:jar:4.11:test
482+
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
483+
[INFO] +- org.mockito:mockito-core:jar:1.9.5:test
484+
[INFO] | \- org.objenesis:objenesis:jar:1.0:test
485+
[INFO] \- org.hamcrest:hamcrest-library:jar:1.3:test
481486
----
482487

483488
The `mvn dependency:tree` command prints tree representation of your project dependencies.
484-
You can see that `spring-boot-starter-parent` provides no
485-
dependenciesby itself. Let's edit our `pom.xml` and add the `spring-boot-starter-web` dependency
489+
You can see that `spring-boot-starter-parent` has already provided some useful test
490+
dependencies. Let's edit our `pom.xml` and add the `spring-boot-starter-web` dependency
486491
just below the `parent` section:
487492

488493
[source,xml,indent=0,subs="verbatim,quotes,attributes"]

spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -1436,19 +1436,19 @@ documentation].
14361436
[[boot-features-testing]]
14371437
== Testing
14381438
Spring Boot provides a number of useful tools for testing your application. The
1439-
`spring-boot-starter-test` POM provides Spring Test, JUnit, Hamcrest and Mockito
1439+
`spring-boot-starter-parent` POM provides JUnit, Hamcrest and Mockito ``test'' `scope`
14401440
dependencies. There are also useful test utilities in the core `spring-boot` module
1441-
under the `org.springframework.boot.test` package.
1441+
under the `org.springframework.boot.test` package. There is also a
1442+
`spring-boot-starter-test` ``Starter POM''.
14421443

14431444

14441445

14451446
[[boot-features-test-scope-dependencies]]
14461447
=== Test scope dependencies
1447-
If you use the
1448+
If you extend your Maven project from the `spring-boot-starter-parent` POM, or use the
14481449
`spring-boot-starter-test` ``Starter POM'' (in the `test` `scope`), you will find
14491450
the following provided libraries:
14501451

1451-
* Spring Test -- integration test support for Spring applications.
14521452
* Junit -- The de-facto standard for unit testing Java applications.
14531453
* Hamcrest -- A library of matcher objects (also known as constraints or predicates)
14541454
allowing `assertThat` style JUnit assertions.

spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ defaults. The parent project provides the following features:
3636
* UTF-8 source encoding.
3737
* A Dependency Management section, allowing you to omit `<version>` tags for common
3838
dependencies.
39+
* Generally useful test dependencies (http://junit.org/[JUnit],
40+
https://code.google.com/p/hamcrest/[Hamcrest],
41+
https://code.google.com/p/mockito/[Mockito]).
3942
* Sensible https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html[resource filtering].
4043
* Sensible plugin configuration (http://mojo.codehaus.org/exec-maven-plugin/[exec plugin],
4144
http://maven.apache.org/surefire/maven-surefire-plugin/[surefire],

spring-boot-starters/spring-boot-starter-parent/pom.xml

+18
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,24 @@
158158
</dependency>
159159
</dependencies>
160160
</dependencyManagement>
161+
<dependencies>
162+
<!-- Generally Useful Test Dependencies -->
163+
<dependency>
164+
<groupId>junit</groupId>
165+
<artifactId>junit</artifactId>
166+
<scope>test</scope>
167+
</dependency>
168+
<dependency>
169+
<groupId>org.mockito</groupId>
170+
<artifactId>mockito-core</artifactId>
171+
<scope>test</scope>
172+
</dependency>
173+
<dependency>
174+
<groupId>org.hamcrest</groupId>
175+
<artifactId>hamcrest-library</artifactId>
176+
<scope>test</scope>
177+
</dependency>
178+
</dependencies>
161179
<build>
162180
<!-- Turn on filtering by default for application properties -->
163181
<resources>

0 commit comments

Comments
 (0)