2017-03-15 04:51:23 +08:00
[[publishing-your-application]]
== Publishing your application
[[publishing-your-application-maven]]
=== Publishing with the `maven` plugin
2019-09-09 17:59:49 +08:00
When the {maven-plugin}[`maven` plugin] is applied, an `Upload` task for the `bootArchives` configuration named `uploadBootArchives` is automatically created.
By default, the `bootArchives` configuration contains the archive produced by the `bootJar` or `bootWar` task.
The `uploadBootArchives` task can be configured to publish the archive to a Maven repository:
2017-03-15 04:51:23 +08:00
2018-09-23 04:39:36 +08:00
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
.Groovy
2017-03-15 04:51:23 +08:00
----
include::../gradle/publishing/maven.gradle[tags=upload]
----
2018-09-23 04:39:36 +08:00
[source,kotlin,indent=0,subs="verbatim,attributes",role="secondary"]
.Kotlin
----
include::../gradle/publishing/maven.gradle.kts[tags=upload]
----
2017-03-15 04:51:23 +08:00
[[publishing-your-application-maven-publish]]
=== Publishing with the `maven-publish` plugin
2019-09-09 17:59:49 +08:00
To publish your Spring Boot jar or war, add it to the publication using the `artifact` method on `MavenPublication`.
Pass the task that produces that artifact that you wish to publish to the `artifact` method.
For example, to publish the artifact produced by the default `bootJar` task:
2017-03-15 04:51:23 +08:00
2018-09-23 04:39:36 +08:00
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
.Groovy
2017-03-15 04:51:23 +08:00
----
include::../gradle/publishing/maven-publish.gradle[tags=publishing]
----
2018-09-23 04:39:36 +08:00
[source,kotlin,indent=0,subs="verbatim,attributes",role="secondary"]
.Kotlin
----
include::../gradle/publishing/maven-publish.gradle.kts[tags=publishing]
----
2017-03-15 04:51:23 +08:00
2017-04-05 19:25:48 +08:00
[[publishing-your-application-distribution]]
2017-03-15 04:51:23 +08:00
=== Distributing with the `application` plugin
2019-09-09 17:59:49 +08:00
When the {application-plugin}[`application` plugin] is applied a distribution named `boot` is created.
This distribution contains the archive produced by the `bootJar` or `bootWar` task and scripts to launch it on Unix-like platforms and Windows.
Zip and tar distributions can be built by the `bootDistZip` and `bootDistTar` tasks respectively.
To use the `application` plugin, its `mainClassName` project property must be configured with the name of your application's main class.