Browse Source

Merge branch '2.0.x'

pull/13358/merge
Andy Wilkinson 8 years ago
parent
commit
0f321abe66
  1. 6
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/reacting.adoc
  2. 2
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java
  3. 2
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleCompatibilitySuite.java
  4. 8
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.java
  5. 9
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.gradle

6
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/reacting.adoc

@ -70,8 +70,10 @@ applied to a project, the Spring Boot plugin will automatically import the @@ -70,8 +70,10 @@ applied to a project, the Spring Boot plugin will automatically import the
When Gradle's {application-plugin}[`application` plugin] is applied to a project, the
Spring Boot plugin:
1. Creates a `CreateStartScripts` task named `bootStartScripts` that will creates scripts
that launch the artifact in the `bootArchives` configuration using `java -jar`.
1. Creates a `CreateStartScripts` task named `bootStartScripts` that will create scripts
that launch the artifact in the `bootArchives` configuration using `java -jar`. The
task is configured to use the `applicationDefaultJvmArgs` property as a convention
for its `defaultJvmOpts` property.
2. Creates a new distribution named `boot` and configures it to contain the artifact in
the `bootArchives` configuration in its `lib` directory and the start scripts in its
`bin` directory.

2
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java

@ -77,6 +77,8 @@ final class ApplicationPluginAction implements PluginApplicationAction { @@ -77,6 +77,8 @@ final class ApplicationPluginAction implements PluginApplicationAction {
() -> new File(project.getBuildDir(), "bootScripts"));
bootStartScripts.getConventionMapping().map("applicationName",
applicationConvention::getApplicationName);
bootStartScripts.getConventionMapping().map("defaultJvmOpts",
applicationConvention::getApplicationDefaultJvmArgs);
CopySpec binCopySpec = project.copySpec().into("bin").from(bootStartScripts);
binCopySpec.setFileMode(0x755);
distribution.getContents().with(binCopySpec);

2
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/junit/GradleCompatibilitySuite.java

@ -39,7 +39,7 @@ import org.springframework.boot.gradle.testkit.GradleBuild; @@ -39,7 +39,7 @@ import org.springframework.boot.gradle.testkit.GradleBuild;
public final class GradleCompatibilitySuite extends Suite {
private static final List<String> GRADLE_VERSIONS = Arrays.asList("default", "4.1",
"4.2", "4.3", "4.4.1", "4.5.1", "4.6", "4.7");
"4.2", "4.3", "4.4.1", "4.5.1", "4.6", "4.7", "4.8");
public GradleCompatibilitySuite(Class<?> clazz) throws InitializationError {
super(clazz, createRunners(clazz));

8
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.java

@ -73,6 +73,14 @@ public class ApplicationPluginActionIntegrationTests { @@ -73,6 +73,14 @@ public class ApplicationPluginActionIntegrationTests {
.contains("bootStartScripts exists = true");
}
@Test
public void createsBootStartScriptsTaskUsesApplicationPluginsDefaultJvmOpts() {
assertThat(this.gradleBuild
.build("startScriptsDefaultJvmOpts", "-PapplyApplicationPlugin")
.getOutput()).contains(
"bootStartScripts defaultJvmOpts = [-Dcom.example.a=alpha, -Dcom.example.b=bravo]");
}
@Test
public void zipDistributionForJarCanBeBuilt() throws IOException {
assertThat(

9
spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/ApplicationPluginActionIntegrationTests.gradle

@ -8,6 +8,7 @@ apply plugin: 'org.springframework.boot' @@ -8,6 +8,7 @@ apply plugin: 'org.springframework.boot'
if (project.hasProperty('applyApplicationPlugin')) {
apply plugin: 'application'
applicationDefaultJvmArgs = ['-Dcom.example.a=alpha', '-Dcom.example.b=bravo']
}
task('taskExists') {
@ -31,3 +32,11 @@ task('javaCompileEncoding') { @@ -31,3 +32,11 @@ task('javaCompileEncoding') {
}
}
}
task('startScriptsDefaultJvmOpts') {
doFirst {
tasks.withType(org.springframework.boot.gradle.tasks.application.CreateBootStartScripts) {
println "$name defaultJvmOpts = $defaultJvmOpts"
}
}
}

Loading…
Cancel
Save