diff --git a/spring-boot-samples/spring-boot-sample-actuator/build.gradle b/spring-boot-samples/spring-boot-sample-actuator/build.gradle index 3a3930054c..0d4912053b 100644 --- a/spring-boot-samples/spring-boot-sample-actuator/build.gradle +++ b/spring-boot-samples/spring-boot-sample-actuator/build.gradle @@ -19,10 +19,7 @@ apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'org.springframework.boot' - -jar { - baseName = 'spring-boot-sample-actuator' -} +apply plugin: 'io.spring.dependency-management' group = 'org.springframework.boot' version = springBootVersion @@ -37,10 +34,6 @@ repositories { } dependencies { - configurations { - insecure.exclude module: 'spring-boot-starter-security' - } - compile("org.springframework.boot:spring-boot-starter-actuator") compile("org.springframework.boot:spring-boot-starter-jdbc") compile("org.springframework.boot:spring-boot-starter-security") @@ -50,18 +43,6 @@ dependencies { compileOnly('org.springframework.boot:spring-boot-configuration-processor') testCompile("org.springframework.boot:spring-boot-starter-test") - - insecure configurations.runtime -} - -// Slightly odd requirement (package a jar file as an insecure app, excluding Spring Security) -// just to demonstrate the "customConfiguration" feature of the Boot gradle plugin. -springBoot { - customConfiguration = "insecure" -} - -task wrapper(type: Wrapper) { - gradleVersion = '1.6' } springBoot { diff --git a/spring-boot-samples/spring-boot-sample-custom-layout/pom.xml b/spring-boot-samples/spring-boot-sample-custom-layout/pom.xml index b118522f10..b545cd9ea7 100644 --- a/spring-boot-samples/spring-boot-sample-custom-layout/pom.xml +++ b/spring-boot-samples/spring-boot-sample-custom-layout/pom.xml @@ -25,18 +25,6 @@ org.springframework.boot spring-boot-loader-tools - - - org.springframework.boot - spring-boot-starter-test - test - - - org.gradle - gradle-tooling-api - ${gradle.version} - test - @@ -96,16 +84,4 @@ - - - gradle - http://repo.gradle.org/gradle/libs-releases-local - - true - - - false - - - diff --git a/spring-boot-samples/spring-boot-sample-custom-layout/src/it/custom/build.gradle b/spring-boot-samples/spring-boot-sample-custom-layout/src/it/custom/build.gradle deleted file mode 100644 index 4bad1c3da1..0000000000 --- a/spring-boot-samples/spring-boot-sample-custom-layout/src/it/custom/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -buildscript { - repositories { - flatDir { - dirs '../..' - } - mavenLocal() - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}" - classpath "org.springframework.boot:spring-boot-sample-custom-layout:${project.bootVersion}" - } -} - -repositories { - mavenLocal() - mavenCentral() -} - -apply plugin: 'java' -apply plugin: 'org.springframework.boot' - -springBoot { - layoutFactory = new sample.layout.SampleLayoutFactory('custom') -} - -dependencies { - compile 'org.springframework.boot:spring-boot-starter' -} diff --git a/spring-boot-samples/spring-boot-sample-custom-layout/src/it/default/build.gradle b/spring-boot-samples/spring-boot-sample-custom-layout/src/it/default/build.gradle deleted file mode 100644 index 7c10b209ff..0000000000 --- a/spring-boot-samples/spring-boot-sample-custom-layout/src/it/default/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -buildscript { - repositories { - flatDir { - dirs '../..' - } - mavenLocal() - } - dependencies { - classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}" - classpath "org.springframework.boot:spring-boot-sample-custom-layout:${project.bootVersion}" - } -} - -repositories { - mavenLocal() - mavenCentral() -} - -apply plugin: 'java' -apply plugin: 'org.springframework.boot' - -dependencies { - compile 'org.springframework.boot:spring-boot-starter' -} diff --git a/spring-boot-samples/spring-boot-sample-custom-layout/src/test/java/sample/layout/GradleIT.java b/spring-boot-samples/spring-boot-sample-custom-layout/src/test/java/sample/layout/GradleIT.java deleted file mode 100644 index b488064a21..0000000000 --- a/spring-boot-samples/spring-boot-sample-custom-layout/src/test/java/sample/layout/GradleIT.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2012-2017 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 sample.layout; - -import java.io.File; -import java.io.FileReader; - -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathFactory; - -import org.gradle.tooling.GradleConnector; -import org.gradle.tooling.ProjectConnection; -import org.gradle.tooling.internal.consumer.DefaultGradleConnector; -import org.junit.Test; -import org.xml.sax.InputSource; - -import org.springframework.util.FileCopyUtils; - -public class GradleIT { - - @Test - public void sampleDefault() throws Exception { - test("default", "sample"); - } - - @Test - public void sampleCustom() throws Exception { - test("custom", "custom"); - } - - private void test(String name, String expected) throws Exception { - File projectDirectory = new File("target/gradleit/" + name); - File javaDirectory = new File( - "target/gradleit/" + name + "/src/main/java/org/test/"); - projectDirectory.mkdirs(); - javaDirectory.mkdirs(); - File script = new File(projectDirectory, "build.gradle"); - FileCopyUtils.copy(new File("src/it/" + name + "/build.gradle"), script); - FileCopyUtils.copy( - new File("src/it/" + name - + "/src/main/java/org/test/SampleApplication.java"), - new File(javaDirectory, "SampleApplication.java")); - GradleConnector gradleConnector = GradleConnector.newConnector(); - gradleConnector.useGradleVersion("2.9"); - ((DefaultGradleConnector) gradleConnector).embedded(true); - ProjectConnection project = gradleConnector.forProjectDirectory(projectDirectory) - .connect(); - project.newBuild().forTasks("clean", "build").setStandardOutput(System.out) - .setStandardError(System.err) - .withArguments("-PbootVersion=" + getBootVersion()).run(); - Verify.verify( - new File("target/gradleit/" + name + "/build/libs/" + name + ".jar"), - expected); - } - - public static String getBootVersion() { - return evaluateExpression( - "/*[local-name()='project']/*[local-name()='parent']/*[local-name()='version']" - + "/text()"); - } - - private static String evaluateExpression(String expression) { - try { - XPathFactory xPathFactory = XPathFactory.newInstance(); - XPath xpath = xPathFactory.newXPath(); - XPathExpression expr = xpath.compile(expression); - String version = expr.evaluate(new InputSource(new FileReader("pom.xml"))); - return version; - } - catch (Exception ex) { - throw new IllegalStateException("Failed to evaluate expression", ex); - } - } - -} diff --git a/spring-boot-samples/spring-boot-sample-custom-layout/src/test/java/sample/layout/Verify.java b/spring-boot-samples/spring-boot-sample-custom-layout/src/test/java/sample/layout/Verify.java deleted file mode 100644 index 496eea6728..0000000000 --- a/spring-boot-samples/spring-boot-sample-custom-layout/src/test/java/sample/layout/Verify.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2012-2016 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 sample.layout; - -import java.io.File; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -public final class Verify { - - private Verify() { - } - - public static void verify(File file, String entry) throws Exception { - ZipFile zipFile = new ZipFile(file); - try { - Enumeration entries = zipFile.entries(); - while (entries.hasMoreElements()) { - if (entries.nextElement().getName().equals(entry)) { - return; - } - } - throw new AssertionError("No entry " + entry); - } - finally { - zipFile.close(); - } - } - -} diff --git a/spring-boot-samples/spring-boot-sample-logback/build.gradle b/spring-boot-samples/spring-boot-sample-logback/build.gradle index 19ca3a9c7b..5033fc9818 100644 --- a/spring-boot-samples/spring-boot-sample-logback/build.gradle +++ b/spring-boot-samples/spring-boot-sample-logback/build.gradle @@ -19,15 +19,10 @@ apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' -jar { - baseName = 'spring-boot-sample-simple' - version = '0.0.0' -} - -bootRun { - systemProperties = System.properties -} +version = springBootVersion +group = 'org.springframework.boot' repositories { // NOTE: You should declare only repositories that you need here @@ -41,8 +36,4 @@ repositories { dependencies { compile("org.springframework.boot:spring-boot-starter") testCompile("org.springframework.boot:spring-boot-starter-test") -} - -task wrapper(type: Wrapper) { - gradleVersion = '1.6' -} +} \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-profile/build.gradle b/spring-boot-samples/spring-boot-sample-profile/build.gradle index 59e1f0d23a..5033fc9818 100644 --- a/spring-boot-samples/spring-boot-sample-profile/build.gradle +++ b/spring-boot-samples/spring-boot-sample-profile/build.gradle @@ -19,23 +19,10 @@ apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' -jar { - baseName = 'spring-boot-sample-profile' - version = '0.0.0' - excludes = ['**/application.yml'] -} - -task('execJar', type:Jar, dependsOn: 'jar') { - baseName = 'spring-boot-sample-profile' - version = '0.0.0' - classifier = 'exec' - from sourceSets.main.output -} - -bootRepackage { - withJarTask = tasks['execJar'] -} +version = springBootVersion +group = 'org.springframework.boot' repositories { // NOTE: You should declare only repositories that you need here @@ -49,8 +36,4 @@ repositories { dependencies { compile("org.springframework.boot:spring-boot-starter") testCompile("org.springframework.boot:spring-boot-starter-test") -} - -task wrapper(type: Wrapper) { - gradleVersion = '1.6' -} +} \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-profile/pom.xml b/spring-boot-samples/spring-boot-sample-profile/pom.xml index 24df492afc..358102090d 100644 --- a/spring-boot-samples/spring-boot-sample-profile/pom.xml +++ b/spring-boot-samples/spring-boot-sample-profile/pom.xml @@ -37,23 +37,6 @@ org.springframework.boot spring-boot-maven-plugin - - maven-jar-plugin - - - lib - - jar - - - lib - - application.yml - - - - - diff --git a/spring-boot-samples/spring-boot-sample-simple/build.gradle b/spring-boot-samples/spring-boot-sample-simple/build.gradle index 19ca3a9c7b..36820a55ec 100644 --- a/spring-boot-samples/spring-boot-sample-simple/build.gradle +++ b/spring-boot-samples/spring-boot-sample-simple/build.gradle @@ -19,15 +19,10 @@ apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' -jar { - baseName = 'spring-boot-sample-simple' - version = '0.0.0' -} - -bootRun { - systemProperties = System.properties -} +version = springBootVersion +group = 'org.springframework.boot' repositories { // NOTE: You should declare only repositories that you need here @@ -40,9 +35,6 @@ repositories { dependencies { compile("org.springframework.boot:spring-boot-starter") + compile("org.hibernate:hibernate-validator") testCompile("org.springframework.boot:spring-boot-starter-test") } - -task wrapper(type: Wrapper) { - gradleVersion = '1.6' -} diff --git a/spring-boot-samples/spring-boot-sample-web-static/build.gradle b/spring-boot-samples/spring-boot-sample-web-static/build.gradle index fed57e1af9..1f777a1f6d 100644 --- a/spring-boot-samples/spring-boot-sample-web-static/build.gradle +++ b/spring-boot-samples/spring-boot-sample-web-static/build.gradle @@ -15,17 +15,12 @@ buildscript { } } - -apply plugin: 'java' -apply plugin: 'eclipse-wtp' -apply plugin: 'idea' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' apply plugin: 'war' -war { - baseName = 'spring-boot-sample-web-static' - version = '0.0.0' -} +version = springBootVersion +group = 'org.springframework.boot' repositories { // NOTE: You should declare only repositories that you need here @@ -36,10 +31,6 @@ repositories { maven { url "http://repo.spring.io/snapshot" } } -configurations { - providedRuntime -} - dependencies { compile("org.springframework.boot:spring-boot-starter-web") compile("org.webjars:bootstrap:3.0.3") @@ -47,5 +38,3 @@ dependencies { providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") testCompile("org.springframework.boot:spring-boot-starter-test") } - -task wrapper(type: Wrapper) { gradleVersion = '1.6' } diff --git a/spring-boot-samples/spring-boot-sample-web-ui/build.gradle b/spring-boot-samples/spring-boot-sample-web-ui/build.gradle index e57c30fbf1..67602012a1 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/build.gradle +++ b/spring-boot-samples/spring-boot-sample-web-ui/build.gradle @@ -17,20 +17,11 @@ buildscript { } } - apply plugin: 'java' -apply plugin: 'eclipse' -apply plugin: 'idea' apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' -springBoot { - classifier = 'exec' -} - -jar { - baseName = 'spring-boot-sample-web-ui' - version = '0.0.0' -} +version = springBootVersion repositories { // NOTE: You should declare only repositories that you need here @@ -46,5 +37,3 @@ dependencies { compile("org.hibernate:hibernate-validator") testCompile("org.springframework.boot:spring-boot-starter-test") } - -task wrapper(type: Wrapper) { gradleVersion = '1.6' }