Use mainClassName consistently across BootRun, BootJar, and BootWar

Previously, BootRun used the main property to configure the name of
the main class to run while BootJar and BootWar used the mainClass
property. Both were different to the application plugin which provides
a mainClassName project property.

This commit updates BootRun, BootJar, and BootWar to change the name
of the property used to configure the name of the main class to be
mainClassName. This makes the three Boot-specific tasks consistent
with each other, and also aligns them with Gradle's own application
plugin.

Closes gh-10622
This commit is contained in:
Andy Wilkinson
2017-10-19 12:11:04 +01:00
parent 671bff2d6f
commit 5502aaafd1
38 changed files with 88 additions and 87 deletions

View File

@@ -9,5 +9,5 @@ apply plugin: 'application'
apply plugin: 'java'
bootJar {
mainClass = 'com.example.ExampleApplication'
mainClassName = 'com.example.ExampleApplication'
}

View File

@@ -9,5 +9,5 @@ apply plugin: 'application'
apply plugin: 'war'
bootWar {
mainClass = 'com.example.ExampleApplication'
mainClassName = 'com.example.ExampleApplication'
}

View File

@@ -9,5 +9,5 @@ apply plugin: 'application'
apply plugin: 'java'
bootJar {
mainClass = 'com.example.ExampleApplication'
mainClassName = 'com.example.ExampleApplication'
}

View File

@@ -9,5 +9,5 @@ apply plugin: 'application'
apply plugin: 'war'
bootWar {
mainClass = 'com.example.ExampleApplication'
mainClassName = 'com.example.ExampleApplication'
}

View File

@@ -8,5 +8,5 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'java'
bootJar {
mainClass = 'com.example.Application'
mainClassName = 'com.example.Application'
}

View File

@@ -8,7 +8,7 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'java'
bootJar {
mainClass = 'com.example.Application'
mainClassName = 'com.example.Application'
classifier = 'boot'
}

View File

@@ -8,5 +8,5 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'war'
bootWar {
mainClass = 'com.example.Application'
mainClassName = 'com.example.Application'
}

View File

@@ -8,7 +8,7 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'war'
bootWar {
mainClass = 'com.example.Application'
mainClassName = 'com.example.Application'
classifier = 'boot'
}

View File

@@ -8,7 +8,7 @@ apply plugin: 'java'
apply plugin: 'org.springframework.boot'
bootJar {
mainClass = 'com.example.CustomMain'
mainClassName = 'com.example.CustomMain'
duplicatesStrategy = "exclude"
}

View File

@@ -8,7 +8,7 @@ apply plugin: 'java'
apply plugin: 'org.springframework.boot'
bootJar {
mainClass = 'com.example.Application'
mainClassName = 'com.example.Application'
if (project.hasProperty('includeLaunchScript') ? includeLaunchScript : false) {
launchScript {
properties 'prop' : project.hasProperty('launchScriptProperty') ? launchScriptProperty : 'default'

View File

@@ -8,7 +8,7 @@ apply plugin: 'war'
apply plugin: 'org.springframework.boot'
bootWar {
mainClass = 'com.example.Application'
mainClassName = 'com.example.Application'
if (project.hasProperty('includeLaunchScript') ? includeLaunchScript : false) {
launchScript {
properties 'prop' : project.hasProperty('launchScriptProperty') ? launchScriptProperty : 'default'

View File

@@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'maven'
bootJar {
mainClass = 'com.example.Application'
mainClassName = 'com.example.Application'
}
group = 'com.example'

View File

@@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'maven'
bootWar {
mainClass = 'com.example.Application'
mainClassName = 'com.example.Application'
}
group = 'com.example'

View File

@@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'maven-publish'
bootJar {
mainClass = 'com.example.Application'
mainClassName = 'com.example.Application'
}
group = 'com.example'

View File

@@ -9,7 +9,7 @@ apply plugin: 'org.springframework.boot'
apply plugin: 'maven-publish'
bootWar {
mainClass = 'com.example.Application'
mainClassName = 'com.example.Application'
}
group = 'com.example'

View File

@@ -10,6 +10,6 @@ apply plugin: 'org.springframework.boot'
task echoMainClassName {
dependsOn compileJava
doLast {
println 'Main class name = ' + bootRun.main
println 'Main class name = ' + bootRun.mainClassName
}
}

View File

@@ -10,5 +10,5 @@ apply plugin: 'org.springframework.boot'
mainClassName = 'com.example.CustomMainClass'
task echoMainClassName {
println 'Main class name = ' + bootRun.main
println 'Main class name = ' + bootRun.mainClassName
}