diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index b65b872c26e..08f963b150b 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -64,7 +64,7 @@ 2.3.22 7.0.2 3.0.0 - 1.6 + 1.12 2.4.1 2.3.1 1.4.185 diff --git a/spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc b/spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc index f1e606b9dbe..7363595a080 100644 --- a/spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc +++ b/spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc @@ -165,8 +165,8 @@ Advanced configuration options and examples are available in the [[build-tool-plugins-gradle-plugin]] == Spring Boot Gradle plugin The Spring Boot Gradle Plugin provides Spring Boot support in Gradle, allowing you to -package executable jar or war archives, run Spring Boot applications and omit version -information from your `build.gradle` file for "`blessed`" dependencies. +package executable jar or war archives, run Spring Boot applications and use the +dependency management provided by `spring-boot-dependencies`. @@ -201,12 +201,15 @@ If you are using a milestone or snapshot release you will also need to add appro -[[build-tool-plugins-gradle-dependencies-without-versions]] -=== Declaring dependencies without versions -The `spring-boot` plugin will register a custom Gradle `ResolutionStrategy` with your -build that allows you to omit version numbers when declaring dependencies to "`blessed`" -artifacts. To make use of this functionality, simply declare dependencies in the usual way, -but leave the version number empty: +[[build-tool-plugins-gradle-dependency-management]] +=== Dependency management +The `spring-boot` plugin automatically applies the +{dependency-management-plugin}/[Dependency Management Plugin] and configures in to import +the `spring-boot-starter-parent` bom. This provides a similar dependency management +experience to the one that is enjoyed by Maven users. For example, it allows you to omit +version numbers when declaring dependencies that are managed in the bom. To make use of +this functionality, simply declare dependencies in the usual way, but leave the version +number empty: [source,groovy,indent=0,subs="verbatim,attributes"] ---- @@ -218,12 +221,12 @@ but leave the version number empty: ---- NOTE: The version of the `spring-boot` gradle plugin that you declare determines the -actual versions of the "`blessed`" dependencies (this ensures that builds are always -repeatable). You should always set the version of the `spring-boot` gradle plugin to the -actual Spring Boot version that you wish to use. Details of the versions that are -provided can be found in the <>. +version of the `spring-boot-starter-parent` bom that is imported (this ensures that builds +are always repeatable). You should always set the version of the `spring-boot` gradle +plugin to the actual Spring Boot version that you wish to use. Details of the versions +that are provided can be found in the <>. -The `spring-boot` plugin will only supply a version where one is not specified. To +The dependency management plugin will only supply a version where one is not specified. To use a version of an artifact that differs from the one that the plugin would provide, simply specify the version when you declare the dependency as you usually would. For example: @@ -235,81 +238,8 @@ example: } ---- - - -[[build-tool-plugins-gradle-custom-version-management]] -==== Custom version management -If is possible to customize the versions used by the `ResolutionStrategy` if you need -to deviate from Spring Boot's "`blessed`" dependencies. Alternative version metadata -is consulted using the `versionManagement` configuration. For example: - -[source,groovy,indent=0,subs="verbatim,attributes"] ----- - dependencies { - versionManagement("com.mycorp:mycorp-versions:1.0.0.RELEASE@properties") - compile("org.springframework.data:spring-data-hadoop") - } ----- - -Version information needs to be published to a repository as a `.properties` file. For -the above example `mycorp-versions.properties` file might contain the following: - -[source,properties,indent=0,subs="verbatim,attributes"] ----- - org.springframework.data\:spring-data-hadoop=2.0.0.RELEASE ----- - -The properties file takes precedence over Spring Boot's defaults, and can be used -to override version numbers if necessary. - - - -[[build-tool-plugins-gradle-exclude-rules]] -=== Default exclude rules -Gradle handles "`exclude rules`" in a slightly different way to Maven which can cause -unexpected results when using the starter POMs. Specifically, exclusions declared on -a dependency will not be applied when the dependency can be reached through a different -path. For example, if a starter POM declares the following: - -[source,xml,indent=0,subs="verbatim,attributes"] ----- - - - org.springframework - spring-core - 4.0.5.RELEASE - - - commons-logging - commons-logging - - - - - org.springframework - spring-context - 4.0.5.RELEASE - - ----- - -The `commons-logging` jar will *not* be excluded by Gradle because it is pulled in -transitively via `spring-context` (`spring-context` -> `spring-core` -> `commons-logging`) -which does not have an `exclusion` element. - -To ensure that correct exclusions are actually applied, the Spring Boot Gradle plugin will -automatically add exclusion rules. All exclusions defined in the -`spring-boot-dependencies` POM and implicit rules for the "`starter`" POMs will be added. - -If you don't want exclusion rules automatically applied you can use the following -configuration: - -[source,groovy,indent=0,subs="verbatim,attributes"] ----- - springBoot { - applyExcludeRules=false - } ----- +To learn more about the capabilities of the Dependency Management Plugin, please refer to +its {dependency-management-plugin-documentation}[documentation]. diff --git a/spring-boot-docs/src/main/asciidoc/cloud-deployment.adoc b/spring-boot-docs/src/main/asciidoc/cloud-deployment.adoc index bf7e75ab0ff..84ffecc6743 100644 --- a/spring-boot-docs/src/main/asciidoc/cloud-deployment.adoc +++ b/spring-boot-docs/src/main/asciidoc/cloud-deployment.adoc @@ -283,8 +283,7 @@ in your `application.properties`, e.g. There's a blog on https://www.openshift.com/blogs/run-gradle-builds-on-openshift[running Gradle in Openshift] on their website that will get you started with a gradle build to -run the app. A http://issues.gradle.org/browse/GRADLE-2871[bug in Gradle] currently -prevents you from using Gradle newer than 1.6. +run the app. diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc index 745705dc23e..16f6058410e 100644 --- a/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -702,21 +702,11 @@ property, e.g. for a simple webapp or service: ==== Use Tomcat 7 with Gradle [[howto-use-tomcat-7-gradle]] -You can use a resolution strategy to change the versions of the Tomcat dependencies, -e.g. for a simple webapp or service: +You can change the Tomcat version by setting the `tomcat.version` property: [source,groovy,indent=0,subs="verbatim,quotes,attributes"] ---- - configurations.all { - resolutionStrategy { - eachDependency { - if (it.requested.group == 'org.apache.tomcat.embed') { - it.useVersion '7.0.59' - } - } - } - } - + ext['tomcat.version'] = '7.0.59' dependencies { compile 'org.springframework.boot:spring-boot-starter-web' } @@ -775,21 +765,12 @@ webapp or service: [[howto-use-jetty-8-gradle]] ==== Use Jetty 8 with Gradle -You can use a resolution strategy to change the version of the Jetty dependencies, e.g. -for a simple webapp or service: +You can set the `jetty.version` property and exclude the WebSocket dependency, e.g. for a +simple webapp or service: [source,groovy,indent=0,subs="verbatim,quotes,attributes"] ---- - configurations.all { - resolutionStrategy { - eachDependency { - if (it.requested.group == 'org.eclipse.jetty') { - it.useVersion '8.1.15.v20140411' - } - } - } - } - + ext['jetty.version'] = '8.1.15.v20140411' dependencies { compile ('org.springframework.boot:spring-boot-starter-web') { exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat' diff --git a/spring-boot-docs/src/main/asciidoc/index.adoc b/spring-boot-docs/src/main/asciidoc/index.adoc index 66d2fe6d54f..f9a1cb452ec 100644 --- a/spring-boot-docs/src/main/asciidoc/index.adoc +++ b/spring-boot-docs/src/main/asciidoc/index.adoc @@ -27,6 +27,8 @@ Phillip Webb; Dave Syer; Josh Long; Stéphane Nicoll; Rob Winch; Andy Wilkinson; :dc-spring-boot: {dc-root}/org/springframework/boot :dc-spring-boot-autoconfigure: {dc-root}/org/springframework/boot/autoconfigure :dc-spring-boot-actuator: {dc-root}/org/springframework/boot/actuate +:dependency-management-plugin: https://github.com/spring-gradle-plugins/dependency-management-plugin +:dependency-management-plugin-documentation: {dependency-management-plugin}/blob/master/README.md :spring-boot-maven-plugin-site: http://docs.spring.io/spring-boot/docs/{spring-boot-docs-version}/maven-plugin :spring-reference: http://docs.spring.io/spring/docs/{spring-docs-version}/spring-framework-reference/htmlsingle :spring-security-reference: http://docs.spring.io/spring-security/site/docs/{spring-security-docs-version}/reference/htmlsingle 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 3f009976e17..7da07f0ae7a 100644 --- a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc +++ b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc @@ -153,11 +153,12 @@ Maven, there is no "`super parent`" to import to share some configuration. } ---- -The <> -is also available and provides tasks to create executable jars and run projects from -source. It also adds a `ResolutionStrategy` that enables you to -<>: +The <> is also available and provides tasks to create executable +jars and run projects from source. It also provides +<> that, among +other capabilities, allows you to omit the version number for any dependencies that are +managed by Spring Boot: [source,groovy,indent=0,subs="attributes"] ---- diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/CustomVersionManagementTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/CustomVersionManagementTests.java deleted file mode 100644 index 26f8c01bba7..00000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/CustomVersionManagementTests.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2012-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.IOException; - -import org.gradle.tooling.ProjectConnection; -import org.junit.BeforeClass; -import org.junit.Test; -import org.springframework.boot.dependency.tools.ManagedDependencies; - -/** - * Tests for using the Gradle plugin's support for custom version management - * - * @author Andy Wilkinson - */ -public class CustomVersionManagementTests { - - private static final String BOOT_VERSION = ManagedDependencies.get() - .find("spring-boot").getVersion(); - - private static ProjectConnection project; - - @BeforeClass - public static void createProject() throws IOException { - project = new ProjectCreator().createProject("custom-version-management"); - } - - @Test - public void exclusionsAreStillInPlace() { - project.newBuild().forTasks("checkExclusions") - .withArguments("-PbootVersion=" + BOOT_VERSION).run(); - } - - @Test - public void customSpringVersionIsUsed() { - project.newBuild().forTasks("checkSpringVersion") - .withArguments("-PbootVersion=" + BOOT_VERSION).run(); - } - -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java index ae3f1c90d5e..ed23c3671db 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/InstallTests.java @@ -34,24 +34,17 @@ public class InstallTests { @Test public void cleanInstall() throws Exception { - project = new ProjectCreator().createProject("installer"); - project.newBuild().forTasks("install") - .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); - } - - @Test - public void cleanInstallVersionManagement() throws Exception { - project = new ProjectCreator().createProject("installer-io"); - project.newBuild().forTasks("install") + this.project = new ProjectCreator().createProject("installer"); + this.project.newBuild().forTasks("install") .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run(); } @Test public void cleanInstallApp() throws Exception { - project = new ProjectCreator().createProject("install-app"); + this.project = new ProjectCreator().createProject("install-app"); // "install" from the application plugin was renamed "installApp" in Gradle // 1.0 - project.newBuild().forTasks("installApp") + this.project.newBuild().forTasks("installApp") .withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace", "--info") .run(); } diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java index 996cce67bc4..5cd2f78ab47 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/java/org/springframework/boot/gradle/SpringLoadedTests.java @@ -60,21 +60,6 @@ public class SpringLoadedTests { "-javaagent:.*springloaded-" + SPRING_LOADED_VERSION + ".jar", output); } - @Test - public void springLoadedCanBeUsedWithGradle16() throws IOException { - ProjectConnection project = new ProjectCreator("1.6") - .createProject("spring-loaded-old-gradle"); - project.newBuild() - .forTasks("bootRun") - .withArguments("-PbootVersion=" + BOOT_VERSION, - "-PspringLoadedVersion=" + SPRING_LOADED_VERSION, "--stacktrace") - .run(); - - List output = getOutput(); - assertOutputMatches( - "-javaagent:.*springloaded-" + SPRING_LOADED_VERSION + ".jar", output); - } - private List getOutput() throws IOException { BufferedReader reader = new BufferedReader(new FileReader(new File( "target/spring-loaded-jvm-args/build/output.txt"))); diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/build.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/build.gradle index 9bc310ab9b4..b5b1eaa5e23 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/build.gradle +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/boot-run-resources/build.gradle @@ -10,6 +10,10 @@ buildscript { apply plugin: 'java' apply plugin: 'spring-boot' +repositories { + mavenLocal() +} + bootRun { addResources = Boolean.valueOf(project.addResources) } \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/custom-version-management.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/custom-version-management.gradle deleted file mode 100644 index d19e2d209bb..00000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/custom-version-management.gradle +++ /dev/null @@ -1,63 +0,0 @@ -import org.gradle.api.artifacts.result.UnresolvedDependencyResult; - -buildscript { - repositories { - mavenLocal() - mavenCentral() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -repositories { - mavenLocal() - mavenCentral() -} - -configurations { - exclusions - springVersion -} - -apply plugin: 'spring-boot' - -dependencies { - exclusions "org.springframework.boot:spring-boot-starter" - springVersion "org.springframework:spring-core" - versionManagement files('../../src/test/resources/custom-versions.properties') -} - -task checkExclusions { - doFirst { - def commonsLogging = getResolvedDependencies(configurations.exclusions) - .find { it.selected.id.group == 'commons-logging' } - if (commonsLogging) { - throw new GradleException("commong-logging is a transitive dependency") - } - } -} - -task checkSpringVersion { - doFirst { - def springVersions = getResolvedDependencies(configurations.springVersion) - .findAll{it.selected.id.group == 'org.springframework'} - .collect {it.selected.id.version} - if (springVersions.size() != 1 || !springVersions.contains("4.0.3.RELEASE")) { - throw new GradleException("Spring version was not 4.0.3.RELEASE") - } - } -} - -def getResolvedDependencies(def configuration) { - def allDependencies = configuration.incoming - .resolutionResult.allDependencies - .split { it instanceof UnresolvedDependencyResult } - - def unresolved = allDependencies.first() - def resolved = allDependencies.last() - if (unresolved) { - throw new GradleException("Resolution failed: ${unresolved}") - } - resolved -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/custom-versions.properties b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/custom-versions.properties deleted file mode 100644 index 20ac076407d..00000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/custom-versions.properties +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework\:spring-core=4.0.3.RELEASE -org.springframework.boot\:spring-boot-starter=1.1.0.RELEASE \ No newline at end of file diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/flatdir.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/flatdir.gradle index f218889dde5..7f4bdde0118 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/flatdir.gradle +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/flatdir.gradle @@ -21,6 +21,7 @@ jar { } repositories { + mavenLocal() flatDir( dirs:'lib' ) } diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/installer-io.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/installer-io.gradle deleted file mode 100644 index 9ed373c88d1..00000000000 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/installer-io.gradle +++ /dev/null @@ -1,41 +0,0 @@ -buildscript { - repositories { - mavenLocal() - } - dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}") - } -} - -apply plugin: 'java' -apply plugin: 'maven' -apply plugin: 'spring-boot' - -group = 'installer' -version = '0.0.0' - -install { - repositories.mavenInstaller { - pom.project { - parent { - groupId 'org.springframework.boot' - artifactId 'spring-boot-starter-parent' - version "${project.bootVersion}" - } - } - } -} - -jar { - baseName = 'installer' -} - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - versionManagement 'io.spring.platform:platform-versions:1.0.0.RELEASE@properties' - compile "org.springframework.boot:spring-boot-starter" -} diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/build.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/build.gradle index cbd9079f600..887ea906987 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/build.gradle +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-common-file-dependency/build.gradle @@ -17,6 +17,10 @@ subprojects { apply plugin: 'spring-boot' +repositories { + mavenLocal() +} + springBoot { mainClass = 'foo.bar.Baz' } diff --git a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-runtime-project-dependency/build.gradle b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-runtime-project-dependency/build.gradle index 53e3dd27553..fe60f4f57e5 100644 --- a/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-runtime-project-dependency/build.gradle +++ b/spring-boot-integration-tests/spring-boot-gradle-tests/src/test/resources/multi-project-runtime-project-dependency/build.gradle @@ -9,6 +9,9 @@ buildscript { project(':projectA') { apply plugin: 'spring-boot' + repositories { + mavenLocal() + } dependencies { runtime project(':projectB') } diff --git a/spring-boot-parent/pom.xml b/spring-boot-parent/pom.xml index 59271539bb9..dfd22b6dc75 100644 --- a/spring-boot-parent/pom.xml +++ b/spring-boot-parent/pom.xml @@ -46,6 +46,11 @@ + + io.spring.gradle + dependency-management-plugin + 0.4.1.RELEASE + jline jline diff --git a/spring-boot-starters/spring-boot-starter-actuator/pom.xml b/spring-boot-starters/spring-boot-starter-actuator/pom.xml index 6c239346f29..039d0957252 100644 --- a/spring-boot-starters/spring-boot-starter-actuator/pom.xml +++ b/spring-boot-starters/spring-boot-starter-actuator/pom.xml @@ -26,15 +26,5 @@ org.springframework.boot spring-boot-actuator - - org.springframework - spring-core - - - commons-logging - commons-logging - - - diff --git a/spring-boot-starters/spring-boot-starter-amqp/pom.xml b/spring-boot-starters/spring-boot-starter-amqp/pom.xml index d5719752b49..3161c2f39bf 100644 --- a/spring-boot-starters/spring-boot-starter-amqp/pom.xml +++ b/spring-boot-starters/spring-boot-starter-amqp/pom.xml @@ -22,24 +22,10 @@ org.springframework.boot spring-boot-starter - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework spring-messaging - - org.springframework - spring-tx - org.springframework.amqp spring-rabbit diff --git a/spring-boot-starters/spring-boot-starter-aop/pom.xml b/spring-boot-starters/spring-boot-starter-aop/pom.xml index 505bfe13a96..a3b35ce10ac 100644 --- a/spring-boot-starters/spring-boot-starter-aop/pom.xml +++ b/spring-boot-starters/spring-boot-starter-aop/pom.xml @@ -26,16 +26,6 @@ org.springframework spring-aop - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.aspectj aspectjrt diff --git a/spring-boot-starters/spring-boot-starter-batch/pom.xml b/spring-boot-starters/spring-boot-starter-batch/pom.xml index e034c949635..2ae76f4c37c 100644 --- a/spring-boot-starters/spring-boot-starter-batch/pom.xml +++ b/spring-boot-starters/spring-boot-starter-batch/pom.xml @@ -26,16 +26,6 @@ org.hsqldb hsqldb - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework spring-jdbc diff --git a/spring-boot-starters/spring-boot-starter-data-elasticsearch/pom.xml b/spring-boot-starters/spring-boot-starter-data-elasticsearch/pom.xml index a59324c1cad..5a8e1e1fbdd 100644 --- a/spring-boot-starters/spring-boot-starter-data-elasticsearch/pom.xml +++ b/spring-boot-starters/spring-boot-starter-data-elasticsearch/pom.xml @@ -22,20 +22,6 @@ org.springframework.boot spring-boot-starter - - org.springframework - spring-core - - - commons-logging - commons-logging - - - - - org.springframework - spring-tx - org.springframework.data spring-data-elasticsearch diff --git a/spring-boot-starters/spring-boot-starter-data-gemfire/pom.xml b/spring-boot-starters/spring-boot-starter-data-gemfire/pom.xml index 6e88806ebdd..c6511501275 100644 --- a/spring-boot-starters/spring-boot-starter-data-gemfire/pom.xml +++ b/spring-boot-starters/spring-boot-starter-data-gemfire/pom.xml @@ -26,28 +26,6 @@ com.gemstone.gemfire gemfire - - org.springframework - spring-core - - - commons-logging - commons-logging - - - - - org.springframework - spring-context - - - org.springframework - spring-context-support - - - org.springframework - spring-tx - org.springframework.data spring-data-gemfire diff --git a/spring-boot-starters/spring-boot-starter-data-jpa/pom.xml b/spring-boot-starters/spring-boot-starter-data-jpa/pom.xml index 8443636c836..933048d8a9a 100644 --- a/spring-boot-starters/spring-boot-starter-data-jpa/pom.xml +++ b/spring-boot-starters/spring-boot-starter-data-jpa/pom.xml @@ -26,16 +26,6 @@ org.springframework.boot spring-boot-starter-aop - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework.boot spring-boot-starter-jdbc @@ -54,10 +44,6 @@ javax.transaction javax.transaction-api - - org.springframework - spring-orm - org.springframework.data spring-data-jpa diff --git a/spring-boot-starters/spring-boot-starter-data-mongodb/pom.xml b/spring-boot-starters/spring-boot-starter-data-mongodb/pom.xml index 6e276ffb06f..1518c82d14b 100644 --- a/spring-boot-starters/spring-boot-starter-data-mongodb/pom.xml +++ b/spring-boot-starters/spring-boot-starter-data-mongodb/pom.xml @@ -26,20 +26,6 @@ org.mongodb mongo-java-driver - - org.springframework - spring-core - - - commons-logging - commons-logging - - - - - org.springframework - spring-tx - org.springframework.data spring-data-mongodb diff --git a/spring-boot-starters/spring-boot-starter-data-rest/pom.xml b/spring-boot-starters/spring-boot-starter-data-rest/pom.xml index 4e005037fb0..82053a2d5d7 100644 --- a/spring-boot-starters/spring-boot-starter-data-rest/pom.xml +++ b/spring-boot-starters/spring-boot-starter-data-rest/pom.xml @@ -34,20 +34,6 @@ com.fasterxml.jackson.core jackson-databind - - org.springframework - spring-core - - - commons-logging - commons-logging - - - - - org.springframework - spring-tx - org.springframework.data spring-data-rest-webmvc diff --git a/spring-boot-starters/spring-boot-starter-data-solr/pom.xml b/spring-boot-starters/spring-boot-starter-data-solr/pom.xml index 2161320dee4..e6e79f26881 100644 --- a/spring-boot-starters/spring-boot-starter-data-solr/pom.xml +++ b/spring-boot-starters/spring-boot-starter-data-solr/pom.xml @@ -32,20 +32,6 @@ - - org.springframework - spring-core - - - commons-logging - commons-logging - - - - - org.springframework - spring-tx - org.springframework.data spring-data-solr diff --git a/spring-boot-starters/spring-boot-starter-freemarker/pom.xml b/spring-boot-starters/spring-boot-starter-freemarker/pom.xml index 6dc2a845c34..bf0006b2f65 100644 --- a/spring-boot-starters/spring-boot-starter-freemarker/pom.xml +++ b/spring-boot-starters/spring-boot-starter-freemarker/pom.xml @@ -30,16 +30,6 @@ org.freemarker freemarker - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework spring-context-support diff --git a/spring-boot-starters/spring-boot-starter-groovy-templates/pom.xml b/spring-boot-starters/spring-boot-starter-groovy-templates/pom.xml index 234a60de8ed..01efe03ca0a 100644 --- a/spring-boot-starters/spring-boot-starter-groovy-templates/pom.xml +++ b/spring-boot-starters/spring-boot-starter-groovy-templates/pom.xml @@ -26,23 +26,9 @@ org.springframework.boot spring-boot-starter-web - - org.codehaus.groovy - groovy - org.codehaus.groovy groovy-templates - - org.springframework - spring-core - - - commons-logging - commons-logging - - - diff --git a/spring-boot-starters/spring-boot-starter-hornetq/pom.xml b/spring-boot-starters/spring-boot-starter-hornetq/pom.xml index bbbeff9d2f8..1c8118c4115 100644 --- a/spring-boot-starters/spring-boot-starter-hornetq/pom.xml +++ b/spring-boot-starters/spring-boot-starter-hornetq/pom.xml @@ -22,16 +22,6 @@ org.springframework.boot spring-boot-starter - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework spring-jms diff --git a/spring-boot-starters/spring-boot-starter-integration/pom.xml b/spring-boot-starters/spring-boot-starter-integration/pom.xml index 55cdc161f1e..aef20eebafa 100644 --- a/spring-boot-starters/spring-boot-starter-integration/pom.xml +++ b/spring-boot-starters/spring-boot-starter-integration/pom.xml @@ -26,32 +26,6 @@ org.springframework.boot spring-boot-starter-aop - - org.springframework - spring-core - - - commons-logging - commons-logging - - - - - org.springframework - spring-messaging - - - org.springframework - spring-tx - - - org.springframework - spring-web - - - org.springframework - spring-webmvc - org.springframework.integration spring-integration-core diff --git a/spring-boot-starters/spring-boot-starter-jdbc/pom.xml b/spring-boot-starters/spring-boot-starter-jdbc/pom.xml index 0dc98da15ec..ed8a983c907 100644 --- a/spring-boot-starters/spring-boot-starter-jdbc/pom.xml +++ b/spring-boot-starters/spring-boot-starter-jdbc/pom.xml @@ -22,27 +22,13 @@ org.springframework.boot spring-boot-starter - - org.springframework - spring-core - - - commons-logging - commons-logging - - - - - org.springframework - spring-jdbc - org.apache.tomcat tomcat-jdbc org.springframework - spring-tx + spring-jdbc diff --git a/spring-boot-starters/spring-boot-starter-jersey/pom.xml b/spring-boot-starters/spring-boot-starter-jersey/pom.xml index 6b926aaf5d8..85571af6920 100644 --- a/spring-boot-starters/spring-boot-starter-jersey/pom.xml +++ b/spring-boot-starters/spring-boot-starter-jersey/pom.xml @@ -34,16 +34,6 @@ org.hibernate hibernate-validator - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework spring-web diff --git a/spring-boot-starters/spring-boot-starter-jta-atomikos/pom.xml b/spring-boot-starters/spring-boot-starter-jta-atomikos/pom.xml index fbed919b8af..42edbcd023e 100644 --- a/spring-boot-starters/spring-boot-starter-jta-atomikos/pom.xml +++ b/spring-boot-starters/spring-boot-starter-jta-atomikos/pom.xml @@ -18,10 +18,6 @@ ${basedir}/../.. - - javax.transaction - javax.transaction-api - org.springframework.boot spring-boot-starter @@ -44,5 +40,9 @@ com.atomikos transactions-jdbc + + javax.transaction + javax.transaction-api + diff --git a/spring-boot-starters/spring-boot-starter-jta-bitronix/pom.xml b/spring-boot-starters/spring-boot-starter-jta-bitronix/pom.xml index 66d917dc2ec..13caec6f707 100644 --- a/spring-boot-starters/spring-boot-starter-jta-bitronix/pom.xml +++ b/spring-boot-starters/spring-boot-starter-jta-bitronix/pom.xml @@ -18,6 +18,10 @@ ${basedir}/../.. + + org.springframework.boot + spring-boot-starter + javax.jms jms-api @@ -36,9 +40,6 @@ - - org.springframework.boot - spring-boot-starter - + diff --git a/spring-boot-starters/spring-boot-starter-log4j2/pom.xml b/spring-boot-starters/spring-boot-starter-log4j2/pom.xml index 4a176d90f97..dcf5927458f 100644 --- a/spring-boot-starters/spring-boot-starter-log4j2/pom.xml +++ b/spring-boot-starters/spring-boot-starter-log4j2/pom.xml @@ -18,14 +18,6 @@ ${basedir}/../.. - - org.slf4j - jcl-over-slf4j - - - org.slf4j - jul-to-slf4j - org.apache.logging.log4j log4j-slf4j-impl @@ -38,5 +30,13 @@ org.apache.logging.log4j log4j-core + + org.slf4j + jcl-over-slf4j + + + org.slf4j + jul-to-slf4j + diff --git a/spring-boot-starters/spring-boot-starter-logging/pom.xml b/spring-boot-starters/spring-boot-starter-logging/pom.xml index 24876b7a75e..bf2eb7387f8 100644 --- a/spring-boot-starters/spring-boot-starter-logging/pom.xml +++ b/spring-boot-starters/spring-boot-starter-logging/pom.xml @@ -18,6 +18,10 @@ ${basedir}/../.. + + ch.qos.logback + logback-classic + org.slf4j jcl-over-slf4j @@ -30,9 +34,5 @@ org.slf4j log4j-over-slf4j - - ch.qos.logback - logback-classic - diff --git a/spring-boot-starters/spring-boot-starter-mail/pom.xml b/spring-boot-starters/spring-boot-starter-mail/pom.xml index 401a7e1d391..1c28d1f74bc 100644 --- a/spring-boot-starters/spring-boot-starter-mail/pom.xml +++ b/spring-boot-starters/spring-boot-starter-mail/pom.xml @@ -22,16 +22,6 @@ org.springframework.boot spring-boot-starter - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework spring-context diff --git a/spring-boot-starters/spring-boot-starter-mobile/pom.xml b/spring-boot-starters/spring-boot-starter-mobile/pom.xml index f96a32eba7b..bb2110fa30f 100644 --- a/spring-boot-starters/spring-boot-starter-mobile/pom.xml +++ b/spring-boot-starters/spring-boot-starter-mobile/pom.xml @@ -26,16 +26,6 @@ org.springframework.boot spring-boot-starter-web - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework.mobile spring-mobile-device diff --git a/spring-boot-starters/spring-boot-starter-mustache/pom.xml b/spring-boot-starters/spring-boot-starter-mustache/pom.xml index 787551c7f40..1c846e3b0f6 100644 --- a/spring-boot-starters/spring-boot-starter-mustache/pom.xml +++ b/spring-boot-starters/spring-boot-starter-mustache/pom.xml @@ -30,15 +30,5 @@ com.samskivert jmustache - - org.springframework - spring-core - - - commons-logging - commons-logging - - - diff --git a/spring-boot-starters/spring-boot-starter-redis/pom.xml b/spring-boot-starters/spring-boot-starter-redis/pom.xml index 5fb0d018f0e..656400ad7b7 100644 --- a/spring-boot-starters/spring-boot-starter-redis/pom.xml +++ b/spring-boot-starters/spring-boot-starter-redis/pom.xml @@ -22,24 +22,6 @@ org.springframework.boot spring-boot-starter - - org.springframework - spring-context-support - - - org.springframework - spring-core - - - commons-logging - commons-logging - - - - - org.springframework - spring-tx - org.springframework.data spring-data-redis diff --git a/spring-boot-starters/spring-boot-starter-remote-shell/pom.xml b/spring-boot-starters/spring-boot-starter-remote-shell/pom.xml index bf92bfc8c25..8e0b0a514c5 100644 --- a/spring-boot-starters/spring-boot-starter-remote-shell/pom.xml +++ b/spring-boot-starters/spring-boot-starter-remote-shell/pom.xml @@ -26,20 +26,6 @@ org.springframework.boot spring-boot-starter-actuator - - org.springframework - spring-core - - - commons-logging - commons-logging - - - - - org.springframework - spring-context - org.crashub crash.cli diff --git a/spring-boot-starters/spring-boot-starter-security/pom.xml b/spring-boot-starters/spring-boot-starter-security/pom.xml index 172e3e65ac8..2e02aed85dc 100644 --- a/spring-boot-starters/spring-boot-starter-security/pom.xml +++ b/spring-boot-starters/spring-boot-starter-security/pom.xml @@ -24,29 +24,7 @@ org.springframework - spring-beans - - - org.springframework - spring-context - - - org.springframework - spring-core - - - commons-logging - commons-logging - - - - - org.springframework - spring-expression - - - org.springframework - spring-web + spring-aop org.springframework.security @@ -56,9 +34,5 @@ org.springframework.security spring-security-web - - org.springframework - spring-aop - diff --git a/spring-boot-starters/spring-boot-starter-social-facebook/pom.xml b/spring-boot-starters/spring-boot-starter-social-facebook/pom.xml index e66ec4883de..fe66b9e2815 100644 --- a/spring-boot-starters/spring-boot-starter-social-facebook/pom.xml +++ b/spring-boot-starters/spring-boot-starter-social-facebook/pom.xml @@ -26,16 +26,6 @@ org.springframework.boot spring-boot-starter-web - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework.social spring-social-config diff --git a/spring-boot-starters/spring-boot-starter-social-linkedin/pom.xml b/spring-boot-starters/spring-boot-starter-social-linkedin/pom.xml index 1c5fb929e52..f07ad790737 100644 --- a/spring-boot-starters/spring-boot-starter-social-linkedin/pom.xml +++ b/spring-boot-starters/spring-boot-starter-social-linkedin/pom.xml @@ -26,16 +26,6 @@ org.springframework.boot spring-boot-starter-web - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework.social spring-social-config diff --git a/spring-boot-starters/spring-boot-starter-social-twitter/pom.xml b/spring-boot-starters/spring-boot-starter-social-twitter/pom.xml index a2833813651..027c8534204 100644 --- a/spring-boot-starters/spring-boot-starter-social-twitter/pom.xml +++ b/spring-boot-starters/spring-boot-starter-social-twitter/pom.xml @@ -26,16 +26,6 @@ org.springframework.boot spring-boot-starter-web - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework.social spring-social-config diff --git a/spring-boot-starters/spring-boot-starter-thymeleaf/pom.xml b/spring-boot-starters/spring-boot-starter-thymeleaf/pom.xml index 97ee0df9ffb..6463508ae12 100644 --- a/spring-boot-starters/spring-boot-starter-thymeleaf/pom.xml +++ b/spring-boot-starters/spring-boot-starter-thymeleaf/pom.xml @@ -26,16 +26,6 @@ org.springframework.boot spring-boot-starter-web - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.thymeleaf thymeleaf-spring4 diff --git a/spring-boot-starters/spring-boot-starter-velocity/pom.xml b/spring-boot-starters/spring-boot-starter-velocity/pom.xml index 519a4ccc799..410990a3461 100644 --- a/spring-boot-starters/spring-boot-starter-velocity/pom.xml +++ b/spring-boot-starters/spring-boot-starter-velocity/pom.xml @@ -18,6 +18,10 @@ ${basedir}/../.. + + org.springframework.boot + spring-boot-starter + org.springframework.boot spring-boot-starter-web @@ -42,16 +46,6 @@ org.apache.velocity velocity-tools - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework spring-context-support diff --git a/spring-boot-starters/spring-boot-starter-web/pom.xml b/spring-boot-starters/spring-boot-starter-web/pom.xml index e8a25f3f6f6..4490d85465a 100644 --- a/spring-boot-starters/spring-boot-starter-web/pom.xml +++ b/spring-boot-starters/spring-boot-starter-web/pom.xml @@ -34,16 +34,6 @@ org.hibernate hibernate-validator - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework spring-web diff --git a/spring-boot-starters/spring-boot-starter-websocket/pom.xml b/spring-boot-starters/spring-boot-starter-websocket/pom.xml index 056829e8e2f..f97be1bbbc5 100644 --- a/spring-boot-starters/spring-boot-starter-websocket/pom.xml +++ b/spring-boot-starters/spring-boot-starter-websocket/pom.xml @@ -26,16 +26,6 @@ org.springframework.boot spring-boot-starter-web - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework spring-messaging diff --git a/spring-boot-starters/spring-boot-starter-ws/pom.xml b/spring-boot-starters/spring-boot-starter-ws/pom.xml index 5e090a7ef07..24a8669d47c 100644 --- a/spring-boot-starters/spring-boot-starter-ws/pom.xml +++ b/spring-boot-starters/spring-boot-starter-ws/pom.xml @@ -26,16 +26,6 @@ org.springframework.boot spring-boot-starter-web - - org.springframework - spring-core - - - commons-logging - commons-logging - - - org.springframework spring-jms diff --git a/spring-boot-tools/spring-boot-gradle-plugin/pom.xml b/spring-boot-tools/spring-boot-gradle-plugin/pom.xml index 4e184cafbcc..af4d91380fb 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/pom.xml +++ b/spring-boot-tools/spring-boot-gradle-plugin/pom.xml @@ -27,6 +27,10 @@ org.springframework.boot spring-boot-dependency-tools + + io.spring.gradle + dependency-management-plugin + org.codehaus.groovy @@ -42,12 +46,7 @@ org.gradle gradle-base-services provided - - - org.gradle - gradle-base-services-groovy - provided - + org.gradle gradle-plugins diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy index 8c95630de66..df85b415f75 100644 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/SpringBootPlugin.groovy @@ -22,9 +22,8 @@ import org.gradle.api.plugins.ApplicationPlugin import org.gradle.api.plugins.BasePlugin import org.gradle.api.plugins.JavaPlugin import org.springframework.boot.gradle.agent.AgentPluginFeatures -import org.springframework.boot.gradle.exclude.ExcludePluginFeatures +import org.springframework.boot.gradle.dependencymanagement.DependencyManagementPluginFeatures import org.springframework.boot.gradle.repackage.RepackagePluginFeatures -import org.springframework.boot.gradle.resolve.ResolvePluginFeatures import org.springframework.boot.gradle.run.RunPluginFeatures @@ -33,23 +32,21 @@ import org.springframework.boot.gradle.run.RunPluginFeatures * * @author Phillip Webb * @author Dave Syer + * @author Andy Wilkinson */ class SpringBootPlugin implements Plugin { @Override void apply(Project project) { - project.getPlugins().apply(BasePlugin) - project.getExtensions().create("springBoot", SpringBootPluginExtension) - project.getConfigurations().create(VersionManagedDependencies.CONFIGURATION); project.getPlugins().apply(JavaPlugin) project.getPlugins().apply(ApplicationPlugin) + new AgentPluginFeatures().apply(project) new RepackagePluginFeatures().apply(project) new RunPluginFeatures().apply(project) - new ResolvePluginFeatures().apply(project) - new ExcludePluginFeatures().apply(project) + new DependencyManagementPluginFeatures().apply(project) useUtf8Encoding(project) } diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/VersionManagedDependencies.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/VersionManagedDependencies.java deleted file mode 100644 index 51dd654cc70..00000000000 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/VersionManagedDependencies.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2012-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Set; - -import org.gradle.api.Project; -import org.gradle.api.artifacts.Configuration; -import org.springframework.boot.dependency.tools.Dependencies; -import org.springframework.boot.dependency.tools.ManagedDependencies; -import org.springframework.boot.dependency.tools.PropertiesFileDependencies; - -/** - * Utility to provide access to {@link ManagedDependencies} with support for version file - * overrides. - * - * @author Phillip Webb - */ -public class VersionManagedDependencies { - - public static final String CONFIGURATION = "versionManagement"; - - private Configuration versionManagementConfiguration; - - private Collection versionManagedDependencies; - - private ManagedDependencies managedDependencies; - - public VersionManagedDependencies(Project project) { - this.versionManagementConfiguration = project.getConfigurations().getByName( - CONFIGURATION); - } - - public ManagedDependencies getManagedDependencies() { - if (this.managedDependencies == null) { - this.managedDependencies = ManagedDependencies - .get(getVersionManagedDependencies()); - } - return this.managedDependencies; - } - - private Collection getVersionManagedDependencies() { - if (versionManagedDependencies == null) { - Set files = versionManagementConfiguration.resolve(); - List dependencies = new ArrayList(files.size()); - for (File file : files) { - dependencies.add(getPropertiesFileManagedDependencies(file)); - } - this.versionManagedDependencies = dependencies; - } - return versionManagedDependencies; - } - - private Dependencies getPropertiesFileManagedDependencies(File file) { - if (!file.getName().toLowerCase().endsWith(".properties")) { - throw new IllegalStateException(file + " is not a version property file"); - } - try { - return new PropertiesFileDependencies(new FileInputStream(file)); - } - catch (IOException ex) { - throw new IllegalStateException(ex); - } - } - -} diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/dependencymanagement/DependencyManagementPluginFeatures.groovy b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/dependencymanagement/DependencyManagementPluginFeatures.groovy new file mode 100644 index 00000000000..e8958f4cdbe --- /dev/null +++ b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/dependencymanagement/DependencyManagementPluginFeatures.groovy @@ -0,0 +1,42 @@ +/* + * Copyright 2012-2015 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.boot.gradle.dependencymanagement; + +import io.spring.gradle.dependencymanagement.DependencyManagementExtension +import io.spring.gradle.dependencymanagement.DependencyManagementPlugin + +import org.gradle.api.Project +import org.springframework.boot.gradle.PluginFeatures + +/** + * {@link PluginFeatures} to configure dependency management + * + * @author Andy Wilkinson + */ +class DependencyManagementPluginFeatures implements PluginFeatures { + + @Override + void apply(Project project) { + project.plugins.apply(DependencyManagementPlugin) + DependencyManagementExtension dependencyManagement = project.extensions + .findByType(DependencyManagementExtension) + dependencyManagement.imports { + def version = DependencyManagementPluginFeatures.class.getPackage().implementationVersion + mavenBom "org.springframework.boot:spring-boot-starter-parent:$version" + } + } +} diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/exclude/ApplyExcludeRules.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/exclude/ApplyExcludeRules.java deleted file mode 100644 index b12e2cb5495..00000000000 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/exclude/ApplyExcludeRules.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2012-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle.exclude; - -import org.gradle.api.Action; -import org.gradle.api.Project; -import org.gradle.api.artifacts.Configuration; -import org.gradle.api.artifacts.Dependency; -import org.gradle.api.artifacts.ModuleDependency; -import org.gradle.api.artifacts.ResolvableDependencies; -import org.gradle.api.internal.artifacts.DefaultExcludeRule; -import org.gradle.api.logging.Logger; -import org.springframework.boot.dependency.tools.Dependency.Exclusion; -import org.springframework.boot.dependency.tools.ManagedDependencies; -import org.springframework.boot.gradle.VersionManagedDependencies; - -/** - * {@link Action} to apply exclude rules. - * - * @author Phillip Webb - */ -public class ApplyExcludeRules implements Action { - - private final Logger logger; - - private final VersionManagedDependencies versionManagedDependencies; - - public ApplyExcludeRules(Project project) { - this.logger = project.getLogger(); - this.versionManagedDependencies = new VersionManagedDependencies(project); - } - - @Override - public void execute(Configuration configuration) { - if (!VersionManagedDependencies.CONFIGURATION.equals(configuration.getName())) { - configuration.getIncoming().beforeResolve( - new Action() { - @Override - public void execute(ResolvableDependencies resolvableDependencies) { - resolvableDependencies.getDependencies().all( - new Action() { - @Override - public void execute(Dependency dependency) { - applyExcludeRules(dependency); - } - }); - } - }); - } - } - - private void applyExcludeRules(Dependency dependency) { - if (dependency instanceof ModuleDependency) { - applyExcludeRules((ModuleDependency) dependency); - } - } - - private void applyExcludeRules(ModuleDependency dependency) { - ManagedDependencies managedDependencies = versionManagedDependencies - .getManagedDependencies(); - // flat directory repositories do not have groups - if (dependency.getGroup() != null) { - org.springframework.boot.dependency.tools.Dependency managedDependency = managedDependencies - .find(dependency.getGroup(), dependency.getName()); - if (managedDependency != null) { - for (Exclusion exclusion : managedDependency.getExclusions()) { - addExcludeRule(dependency, exclusion); - } - addImplicitExcludeRules(dependency); - return; - } - } - logger.debug("No exclusions rules applied for non-managed dependency " - + dependency); - } - - private void addExcludeRule(ModuleDependency dependency, Exclusion exclusion) { - logger.info("Adding managed exclusion rule " + exclusion + " to " + dependency); - DefaultExcludeRule rule = new DefaultExcludeRule(exclusion.getGroupId(), - exclusion.getArtifactId()); - dependency.getExcludeRules().add(rule); - } - - private void addImplicitExcludeRules(ModuleDependency dependency) { - if (isStarter(dependency)) { - logger.info("Adding implicit managed exclusion rules to starter " - + dependency); - dependency.getExcludeRules().add( - new DefaultExcludeRule("commons-logging", "commons-logging")); - dependency.getExcludeRules().add( - new DefaultExcludeRule("commons-logging", "commons-logging-api")); - } - } - - private boolean isStarter(ModuleDependency dependency) { - return (dependency.getGroup() != null - && dependency.getGroup().equals("org.springframework.boot") && dependency - .getName().startsWith("spring-boot-starter")); - } - -} diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/exclude/ExcludePluginFeatures.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/exclude/ExcludePluginFeatures.java deleted file mode 100644 index 26510ff488b..00000000000 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/exclude/ExcludePluginFeatures.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2012-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle.exclude; - -import org.gradle.api.Project; -import org.springframework.boot.gradle.PluginFeatures; -import org.springframework.boot.gradle.SpringBootPluginExtension; - -/** - * {@link PluginFeatures} to apply exclusion rules. - * - * @author Phillip Webb - */ -public class ExcludePluginFeatures implements PluginFeatures { - - @Override - public void apply(Project project) { - SpringBootPluginExtension extension = project.getExtensions().getByType( - SpringBootPluginExtension.class); - if (extension.isApplyExcludeRules()) { - project.getConfigurations().all(new ApplyExcludeRules(project)); - } - } - -} diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/resolve/ResolvePluginFeatures.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/resolve/ResolvePluginFeatures.java deleted file mode 100644 index d17057f228f..00000000000 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/resolve/ResolvePluginFeatures.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2012-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle.resolve; - -import org.gradle.api.Action; -import org.gradle.api.Project; -import org.gradle.api.artifacts.Configuration; -import org.springframework.boot.gradle.PluginFeatures; - -/** - * {@link PluginFeatures} to add version resolution support. - * - * @author Phillip Webb - */ -public class ResolvePluginFeatures implements PluginFeatures { - - @Override - public void apply(final Project project) { - project.getConfigurations().all(new Action() { - @Override - public void execute(Configuration configuration) { - SpringBootResolutionStrategy.applyToConfiguration(project, configuration); - } - }); - } - -} diff --git a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/resolve/SpringBootResolutionStrategy.java b/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/resolve/SpringBootResolutionStrategy.java deleted file mode 100644 index 521fd68a604..00000000000 --- a/spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/resolve/SpringBootResolutionStrategy.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2012-2014 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.gradle.resolve; - -import org.gradle.api.Action; -import org.gradle.api.Project; -import org.gradle.api.artifacts.Configuration; -import org.gradle.api.artifacts.DependencyResolveDetails; -import org.gradle.api.artifacts.ModuleVersionSelector; -import org.springframework.boot.dependency.tools.Dependency; -import org.springframework.boot.dependency.tools.ManagedDependencies; -import org.springframework.boot.gradle.VersionManagedDependencies; - -/** - * A resolution strategy to resolve missing version numbers using the - * 'spring-boot-dependencies' POM. - * - * @author Phillip Webb - */ -public class SpringBootResolutionStrategy { - - private static final String SPRING_BOOT_GROUP = "org.springframework.boot"; - - public static void applyToConfiguration(final Project project, - Configuration configuration) { - if (VersionManagedDependencies.CONFIGURATION.equals(configuration.getName())) { - return; - } - VersionResolver versionResolver = new VersionResolver(project); - configuration.getResolutionStrategy().eachDependency(versionResolver); - } - - private static class VersionResolver implements Action { - - private final VersionManagedDependencies versionManagedDependencies; - - public VersionResolver(Project project) { - this.versionManagedDependencies = new VersionManagedDependencies(project); - } - - @Override - public void execute(DependencyResolveDetails resolveDetails) { - String version = resolveDetails.getTarget().getVersion(); - if (version == null || version.trim().length() == 0) { - resolve(resolveDetails); - } - } - - private void resolve(DependencyResolveDetails resolveDetails) { - ManagedDependencies dependencies = this.versionManagedDependencies - .getManagedDependencies(); - ModuleVersionSelector target = resolveDetails.getTarget(); - if (SPRING_BOOT_GROUP.equals(target.getGroup())) { - resolveDetails.useVersion(dependencies.getSpringBootVersion()); - return; - } - Dependency dependency = dependencies - .find(target.getGroup(), target.getName()); - if (dependency != null) { - resolveDetails.useVersion(dependency.getVersion()); - } - } - - } -}