Skip to content

Commit 5502aaa

Browse files
committed
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
1 parent 671bff2 commit 5502aaa

File tree

38 files changed

+88
-87
lines changed

38 files changed

+88
-87
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/packaging.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ By default, the executable archive's main class will be configured automatically
8585
looking for a class with a `public static void main(String[])` method in directories on
8686
the task's classpath.
8787

88-
The main class can also be configured explicitly using the task's `mainClass` property:
88+
The main class can also be configured explicitly using the task's `mainClassName`
89+
property:
8990

9091
[source,groovy,indent=0,subs="verbatim"]
9192
----

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/asciidoc/running.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ To run your application without first building an archive use the `bootRun` task
1111
The `bootRun` task is automatically configured to use the runtime classpath of the
1212
main source set. By default, the main class will be discovered by looking for a class
1313
with a `public static void main(String[])` method in directories on the task's
14-
classpath. The main class can also be configured explicitly using the task's `main`
15-
property:
14+
classpath. The main class can also be configured explicitly using the task's
15+
`mainClassName` property:
1616

1717
[source,groovy,indent=0,subs="verbatim"]
1818
----

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/packaging/boot-jar-and-jar.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ bootJar {
2020
// end::classifier[]
2121

2222
bootJar {
23-
mainClass = 'com.example.Application'
23+
mainClassName = 'com.example.Application'
2424
}

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/packaging/boot-jar-custom-launch-script.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apply plugin: 'org.springframework.boot'
88
apply plugin: 'java'
99

1010
bootJar {
11-
mainClass 'com.example.ExampleApplication'
11+
mainClassName 'com.example.ExampleApplication'
1212
}
1313

1414
// tag::custom-launch-script[]

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/packaging/boot-jar-include-launch-script.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apply plugin: 'org.springframework.boot'
88
apply plugin: 'java'
99

1010
bootJar {
11-
mainClass 'com.example.ExampleApplication'
11+
mainClassName 'com.example.ExampleApplication'
1212
}
1313

1414
// tag::include-launch-script[]

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/packaging/boot-jar-launch-script-properties.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apply plugin: 'org.springframework.boot'
88
apply plugin: 'java'
99

1010
bootJar {
11-
mainClass 'com.example.ExampleApplication'
11+
mainClassName 'com.example.ExampleApplication'
1212
}
1313

1414
// tag::launch-script-properties[]

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/packaging/boot-jar-main-class.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ apply plugin: 'java'
99

1010
// tag::main-class[]
1111
bootJar {
12-
mainClass = 'com.example.ExampleApplication'
12+
mainClassName = 'com.example.ExampleApplication'
1313
}
1414
// end::main-class[]

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/packaging/boot-jar-requires-unpack.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies {
1616
}
1717

1818
bootJar {
19-
mainClass 'com.example.ExampleApplication'
19+
mainClassName 'com.example.ExampleApplication'
2020
}
2121

2222
// tag::requires-unpack[]

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/packaging/boot-war-include-devtools.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apply plugin: 'org.springframework.boot'
88
apply plugin: 'war'
99

1010
bootWar {
11-
mainClass 'com.example.ExampleApplication'
11+
mainClassName 'com.example.ExampleApplication'
1212
classpath file('spring-boot-devtools-1.2.3.RELEASE.jar')
1313
}
1414

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/gradle/packaging/boot-war-properties-launcher.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apply plugin: 'org.springframework.boot'
88
apply plugin: 'war'
99

1010
bootWar {
11-
mainClass 'com.example.ExampleApplication'
11+
mainClassName 'com.example.ExampleApplication'
1212
}
1313

1414
// tag::properties-launcher[]

0 commit comments

Comments
 (0)