Skip to content

Commit af825fa

Browse files
author
Dave Syer
committed
Clarify docs on Gradle configuration
1 parent 34a3299 commit af825fa

File tree

1 file changed

+47
-11
lines changed

1 file changed

+47
-11
lines changed

spring-boot-docs/src/main/asciidoc/build-tool-plugins.adoc

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,11 @@ To run a project in place without building a jar first you can use the ``bootRun
372372
Running this way makes your static classpath resources (i.e. in `src/main/resources` by
373373
default) reloadable in the live application, which can be helpful at development time.
374374

375-
[[build-tool-plugins-gradle-repackage-configuration]]
376-
=== Repackage configuration
375+
[[build-tool-plugins-gradle-global-configuration]]
376+
=== Spring Boot Plugin configuration
377377
The gradle plugin automatically extends your build script DSL with a `springBoot` element
378-
for configuration. Simply set the appropriate properties as you would with any other Gradle
379-
extension (see below for a list of configuration options):
378+
for global configuration of the Boot plugin. Set the appropriate properties as you would
379+
with any other Gradle extension (see below for a list of configuration options):
380380

381381
[source,groovy,indent=0,subs="verbatim,attributes"]
382382
----
@@ -386,6 +386,47 @@ extension (see below for a list of configuration options):
386386
----
387387

388388

389+
[[build-tool-plugins-gradle-repackage-configuration]]
390+
=== Repackage configuration
391+
The plugin adds a `bootRepackage` task which you can also configure directly, e.g.:
392+
393+
[source,groovy,indent=0,subs="verbatim,attributes"]
394+
----
395+
bootRepackage {
396+
mainClass = 'demo.Application'
397+
}
398+
----
399+
400+
The following configuration options are available:
401+
402+
[cols="2,4"]
403+
|===
404+
|Name |Description
405+
406+
|`mainClass`
407+
|The main class that should be run. If not specified the `mainClassName` project property
408+
will be used or, if the no `mainClassName` id defined the archive will be searched for a
409+
suitable class. "Suitable" means a unique class with a well-formed `main()` method (if
410+
more than one is found the build will fail). You should also be able to specify the main
411+
class name via the "run" task (`main` property) and/or the "startScripts" (`mainClassName`
412+
property) as an alternative to using the "springBoot" configuration.
413+
414+
|`classifier`
415+
|A file name segment (before the extension) to add to the archive, so that the original is
416+
preserved in its original location. Defaults to null in which case the archive is repackaged
417+
in place. The default is convenient for many purposes, but if you want to use the
418+
original jar as a dependency in another project, it's best to use an extension to define the
419+
executable archive.
420+
421+
|`withJarTask`
422+
|The name of the `Jar` task (defaults to all) which is used to locate the archive to repackage.
423+
424+
|`customConfiguration`
425+
|The name of the custom configuration whuch is used to populate the nested lib directory
426+
(without specifying this you get all compile and runtime dependencies).
427+
428+
|===
429+
389430

390431
[[build-tool-plugins-gradle-repackage-custom-configuration]]
391432
=== Repackage with custom Gradle configuration
@@ -449,12 +490,7 @@ The following configuration options are available:
449490
|Name |Description
450491

451492
|`mainClass`
452-
|The main class that should be run. If not specified the `mainClassName` project property
453-
will be used or, if the no `mainClassName` id defined the archive will be searched for a
454-
suitable class. "Suitable" means a unique class with a well-formed `main()` method (if
455-
more than one is found the build will fail). You should also be able to specify the main
456-
class name via the "run" task (`main` property) and/or the "startScripts" (`mainClassName`
457-
property) as an alternative to using the "springBoot" configuration.
493+
|The main class that should be run by the executable archive.
458494

459495
|`providedConfiguration`
460496
|The name of the provided configuration (defaults to `providedRuntime`).
@@ -486,7 +522,7 @@ usually this is not an issue; however, if you are planning to create a more comp
486522
project setup, with custom `Jar` and `BootRepackage` tasks, there are few tweaks to
487523
consider.
488524

489-
If you are 'just' creating custom jar files from your project you can simply disables
525+
If you are 'just' creating custom jar files from your project you can simply disable
490526
default `jar` and `bootRepackage` tasks:
491527

492528
[source,groovy,indent=0,subs="verbatim,attributes"]

0 commit comments

Comments
 (0)