This commit is contained in:
Andy Wilkinson
2017-10-24 14:41:03 +01:00
parent 7065a41711
commit a256602c7b
23 changed files with 78 additions and 62 deletions

View File

@@ -40,7 +40,8 @@ import org.gradle.process.JavaExecSpec;
*/
public class BootRun extends DefaultTask {
private final PropertyState<String> mainClassName = getProject().property(String.class);
private final PropertyState<String> mainClassName = getProject()
.property(String.class);
@SuppressWarnings("unchecked")
private final PropertyState<List<String>> jvmArgs = (PropertyState<List<String>>) (Object) getProject()
@@ -90,7 +91,8 @@ public class BootRun extends DefaultTask {
}
/**
* Sets the name of the main class to be executed using the given {@code mainClassNameProvider}.
* Sets the name of the main class to be executed using the given
* {@code mainClassNameProvider}.
*
* @param mainClassNameProvider provider of the main class name
*/

View File

@@ -92,14 +92,14 @@ public class PackagingDocumentationTests {
@Test
public void springBootDslMainClass() throws IOException {
this.gradleBuild
.script("src/main/gradle/packaging/spring-boot-dsl-main-class.gradle")
.build("bootJar");
.script("src/main/gradle/packaging/spring-boot-dsl-main-class.gradle")
.build("bootJar");
File file = new File(this.gradleBuild.getProjectDir(),
"build/libs/" + this.gradleBuild.getProjectDir().getName() + ".jar");
assertThat(file).isFile();
try (JarFile jar = new JarFile(file)) {
assertThat(jar.getManifest().getMainAttributes().getValue("Start-Class"))
.isEqualTo("com.example.ExampleApplication");
.isEqualTo("com.example.ExampleApplication");
}
}

View File

@@ -56,7 +56,7 @@ public class RunningDocumentationTests {
assertThat(this.gradleBuild
.script("src/main/gradle/running/spring-boot-dsl-main-class-name.gradle")
.build("configuredMainClass").getOutput())
.contains("com.example.ExampleApplication");
.contains("com.example.ExampleApplication");
}
@Test

View File

@@ -120,9 +120,9 @@ public abstract class AbstractBootArchiveIntegrationTests {
.getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
try (JarFile jarFile = new JarFile(
new File(this.gradleBuild.getProjectDir(), "build/libs")
.listFiles()[0])) {
.listFiles()[0])) {
assertThat(jarFile.getManifest().getMainAttributes().getValue("Start-Class"))
.isEqualTo("com.example.CustomMain");
.isEqualTo("com.example.CustomMain");
}
}

View File

@@ -196,7 +196,8 @@ public class GradleBuild implements TestRule {
XPathFactory xPathFactory = XPathFactory.newInstance();
XPath xpath = xPathFactory.newXPath();
XPathExpression expr = xpath.compile(expression);
String version = expr.evaluate(new InputSource(new FileReader(".flattened-pom.xml")));
String version = expr
.evaluate(new InputSource(new FileReader(".flattened-pom.xml")));
return version;
}
catch (Exception ex) {

View File

@@ -43,14 +43,14 @@ public class RunArgumentsTests {
@Test
public void parseArrayContainingNullValue() {
String[] args = new RunArguments(new String[]{"foo", null, "bar"}).asArray();
String[] args = new RunArguments(new String[] { "foo", null, "bar" }).asArray();
assertThat(args).isNotNull();
assertThat(args).containsOnly("foo", "bar");
}
@Test
public void parseArrayContainingEmptyValue() {
String[] args = new RunArguments(new String[]{"foo", "", "bar"}).asArray();
String[] args = new RunArguments(new String[] { "foo", "", "bar" }).asArray();
assertThat(args).isNotNull();
assertThat(args).containsOnly("foo", "", "bar");
}