52 lines
2.0 KiB
Plaintext
52 lines
2.0 KiB
Plaintext
[[publishing-your-application]]
|
|
== Publishing your Application
|
|
|
|
|
|
|
|
[[publishing-your-application-maven]]
|
|
=== Publishing with the Maven Plugin
|
|
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:
|
|
|
|
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
|
|
.Groovy
|
|
----
|
|
include::../gradle/publishing/maven.gradle[tags=upload]
|
|
----
|
|
|
|
[source,kotlin,indent=0,subs="verbatim,attributes",role="secondary"]
|
|
.Kotlin
|
|
----
|
|
include::../gradle/publishing/maven.gradle.kts[tags=upload]
|
|
----
|
|
|
|
|
|
|
|
[[publishing-your-application-maven-publish]]
|
|
=== Publishing with the Maven-publish Plugin
|
|
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:
|
|
|
|
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
|
|
.Groovy
|
|
----
|
|
include::../gradle/publishing/maven-publish.gradle[tags=publishing]
|
|
----
|
|
|
|
[source,kotlin,indent=0,subs="verbatim,attributes",role="secondary"]
|
|
.Kotlin
|
|
----
|
|
include::../gradle/publishing/maven-publish.gradle.kts[tags=publishing]
|
|
----
|
|
|
|
|
|
|
|
[[publishing-your-application-distribution]]
|
|
=== Distributing with the Application Plugin
|
|
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` property must be configured with the name of your application's main class.
|