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:
@@ -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'
|
||||
}
|
||||
@@ -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'
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user