Revert "Remove test dependencies from spring-boot-starter-parent"

This reverts commit 5ded496dc3.

Fixes gh-628
This commit is contained in:
Phillip Webb 2014-04-06 21:50:22 -07:00
parent 2bb0f744e0
commit 13517598a4
4 changed files with 33 additions and 7 deletions

View File

@ -203,7 +203,7 @@ endif::release[]
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("junit:junit")
}
----
@ -478,11 +478,16 @@ currently have.
$ mvn dependency:tree
[INFO] com.example:myproject:jar:0.0.1-SNAPSHOT
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.mockito:mockito-core:jar:1.9.5:test
[INFO] | \- org.objenesis:objenesis:jar:1.0:test
[INFO] \- org.hamcrest:hamcrest-library:jar:1.3:test
----
The `mvn dependency:tree` command prints tree representation of your project dependencies.
You can see that `spring-boot-starter-parent` provides no
dependenciesby itself. Let's edit our `pom.xml` and add the `spring-boot-starter-web` dependency
You can see that `spring-boot-starter-parent` has already provided some useful test
dependencies. Let's edit our `pom.xml` and add the `spring-boot-starter-web` dependency
just below the `parent` section:
[source,xml,indent=0,subs="verbatim,quotes,attributes"]

View File

@ -1436,19 +1436,19 @@ documentation].
[[boot-features-testing]]
== Testing
Spring Boot provides a number of useful tools for testing your application. The
`spring-boot-starter-test` POM provides Spring Test, JUnit, Hamcrest and Mockito
`spring-boot-starter-parent` POM provides JUnit, Hamcrest and Mockito ``test'' `scope`
dependencies. There are also useful test utilities in the core `spring-boot` module
under the `org.springframework.boot.test` package.
under the `org.springframework.boot.test` package. There is also a
`spring-boot-starter-test` ``Starter POM''.
[[boot-features-test-scope-dependencies]]
=== Test scope dependencies
If you use the
If you extend your Maven project from the `spring-boot-starter-parent` POM, or use the
`spring-boot-starter-test` ``Starter POM'' (in the `test` `scope`), you will find
the following provided libraries:
* Spring Test -- integration test support for Spring applications.
* Junit -- The de-facto standard for unit testing Java applications.
* Hamcrest -- A library of matcher objects (also known as constraints or predicates)
allowing `assertThat` style JUnit assertions.

View File

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

View File

@ -158,6 +158,24 @@
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Generally Useful Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Turn on filtering by default for application properties -->
<resources>