Add mainClassName to springBoot DSL in Gradle plugin

This commit introduces a new mainClassName property on the springBoot
DSL provided by the Gradle plugin. It can be used to explicitly
configure the mainClassName of the default bootRun, bootJar, and
bootWar tasks in a single place. Previously, the only mechanism
provided to do so was the mainClassName property that's only available
when the application plugin has been applied.

Closes gh-10623
This commit is contained in:
Andy Wilkinson
2017-10-19 13:55:13 +01:00
parent 5502aaafd1
commit ccca943e33
14 changed files with 242 additions and 4 deletions

View File

@@ -0,0 +1,13 @@
buildscript {
dependencies {
classpath files(pluginClasspath.split(','))
}
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'application'
springBoot {
mainClassName = 'com.example.CustomMain'
}

View File

@@ -0,0 +1,13 @@
buildscript {
dependencies {
classpath files(pluginClasspath.split(','))
}
}
apply plugin: 'war'
apply plugin: 'org.springframework.boot'
apply plugin: 'application'
springBoot {
mainClassName = 'com.example.CustomMain'
}

View File

@@ -0,0 +1,16 @@
buildscript {
dependencies {
classpath files(pluginClasspath.split(','))
}
}
apply plugin: 'application'
apply plugin: 'org.springframework.boot'
springBoot {
mainClassName = 'com.example.CustomMainClass'
}
task echoMainClassName {
println 'Main class name = ' + bootRun.mainClassName
}