Revert "Rework BootRun so that it does not subclass JavaExec"
This reverts commit 6eee9de3c1.
Closes gh-10872
This commit is contained in:
@@ -18,7 +18,6 @@ package com.example;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Very basic application used for testing {@code BootRun}.
|
||||
@@ -32,12 +31,6 @@ public class BootRunApplication {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
dumpClassPath();
|
||||
dumpArgs(args);
|
||||
dumpJvmArgs();
|
||||
}
|
||||
|
||||
private static void dumpClassPath() {
|
||||
int i = 1;
|
||||
for (String entry : ManagementFactory.getRuntimeMXBean().getClassPath()
|
||||
.split(File.pathSeparator)) {
|
||||
@@ -45,12 +38,4 @@ public class BootRunApplication {
|
||||
}
|
||||
}
|
||||
|
||||
private static void dumpArgs(String[] args) {
|
||||
System.out.println(Arrays.toString(args));
|
||||
}
|
||||
|
||||
private static void dumpJvmArgs() {
|
||||
System.out.println(ManagementFactory.getRuntimeMXBean().getInputArguments());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,11 +67,4 @@ public class RunningDocumentationTests {
|
||||
.contains(new File("src/main/resources").getPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bootRunExecSpecCustomization() throws IOException {
|
||||
this.gradleBuild
|
||||
.script("src/main/gradle/running/boot-run-custom-exec-spec.gradle")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,33 +56,6 @@ public class BootRunIntegrationTests {
|
||||
.doesNotContain(canonicalPathOf("src/main/resources"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void argsCanBeConfigured() throws IOException {
|
||||
copyApplication();
|
||||
new File(this.gradleBuild.getProjectDir(), "src/main/resources").mkdirs();
|
||||
BuildResult result = this.gradleBuild.build("bootRun");
|
||||
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(result.getOutput()).contains("--com.example.foo=bar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jvmArgsCanBeConfigured() throws IOException {
|
||||
copyApplication();
|
||||
new File(this.gradleBuild.getProjectDir(), "src/main/resources").mkdirs();
|
||||
BuildResult result = this.gradleBuild.build("bootRun");
|
||||
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(result.getOutput()).contains("-Dcom.example.foo=bar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void execSpecCanBeConfigured() throws IOException {
|
||||
copyApplication();
|
||||
new File(this.gradleBuild.getProjectDir(), "src/main/resources").mkdirs();
|
||||
BuildResult result = this.gradleBuild.build("bootRun");
|
||||
assertThat(result.task(":bootRun").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(result.getOutput()).contains("-Dcom.example.foo=bar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sourceResourcesCanBeUsed() throws IOException {
|
||||
copyApplication();
|
||||
|
||||
@@ -10,6 +10,6 @@ apply plugin: 'org.springframework.boot'
|
||||
task echoMainClassName {
|
||||
dependsOn compileJava
|
||||
doLast {
|
||||
println 'Main class name = ' + bootRun.mainClassName
|
||||
println 'Main class name = ' + bootRun.main
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,5 @@ apply plugin: 'org.springframework.boot'
|
||||
mainClassName = 'com.example.CustomMainClass'
|
||||
|
||||
task echoMainClassName {
|
||||
println 'Main class name = ' + bootRun.mainClassName
|
||||
println 'Main class name = ' + bootRun.main
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath files(pluginClasspath.split(','))
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
bootRun {
|
||||
args = ['--com.example.foo=bar']
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath files(pluginClasspath.split(','))
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
|
||||
bootRun {
|
||||
execSpec {
|
||||
systemProperty 'com.example.foo', 'bar'
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath files(pluginClasspath.split(','))
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'org.springframework.boot'
|
||||
|
||||
bootRun {
|
||||
jvmArgs = ['-Dcom.example.foo=bar']
|
||||
}
|
||||
@@ -12,5 +12,5 @@ springBoot {
|
||||
}
|
||||
|
||||
task echoMainClassName {
|
||||
println 'Main class name = ' + bootRun.mainClassName
|
||||
println 'Main class name = ' + bootRun.main
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user