From 13517598a41d8636b3f3a6f86464f6cf9976ab75 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Sun, 6 Apr 2014 21:50:22 -0700 Subject: [PATCH] Revert "Remove test dependencies from spring-boot-starter-parent" This reverts commit 5ded496dc32770148935574ff1c649799f251413. Fixes gh-628 --- .../src/main/asciidoc/getting-started.adoc | 11 ++++++++--- .../main/asciidoc/spring-boot-features.adoc | 8 ++++---- .../src/main/asciidoc/using-spring-boot.adoc | 3 +++ .../spring-boot-starter-parent/pom.xml | 18 ++++++++++++++++++ 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/spring-boot-docs/src/main/asciidoc/getting-started.adoc b/spring-boot-docs/src/main/asciidoc/getting-started.adoc index ac6adc97148..edec710ec0c 100644 --- a/spring-boot-docs/src/main/asciidoc/getting-started.adoc +++ b/spring-boot-docs/src/main/asciidoc/getting-started.adoc @@ -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"] diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 15276c8eddb..757008d15f3 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -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. diff --git a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc index f0c138b4b06..adf747bc6c7 100644 --- a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc +++ b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc @@ -36,6 +36,9 @@ defaults. The parent project provides the following features: * UTF-8 source encoding. * A Dependency Management section, allowing you to omit `` 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], diff --git a/spring-boot-starters/spring-boot-starter-parent/pom.xml b/spring-boot-starters/spring-boot-starter-parent/pom.xml index d9e5e8b749d..5808e65fb5d 100644 --- a/spring-boot-starters/spring-boot-starter-parent/pom.xml +++ b/spring-boot-starters/spring-boot-starter-parent/pom.xml @@ -158,6 +158,24 @@ + + + + junit + junit + test + + + org.mockito + mockito-core + test + + + org.hamcrest + hamcrest-library + test + +