Skip to content

Commit

Permalink
Merge pull request #25299 from robert-smith-911
Browse files Browse the repository at this point in the history
* gh-25299:
  Polish "Encourage use of maven-publish plugin in Gradle docs"
  Encourage use of maven-publish plugin in Gradle docs

Closes gh-25299
  • Loading branch information
wilkinsona committed Feb 16, 2021
2 parents 29af4b9 + a2adb87 commit 08802d3
Showing 1 changed file with 17 additions and 14 deletions.
Expand Up @@ -3,42 +3,45 @@



[[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:
[[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.gradle[tags=upload]
include::../gradle/publishing/maven-publish.gradle[tags=publishing]
----

[source,kotlin,indent=0,subs="verbatim,attributes",role="secondary"]
.Kotlin
----
include::../gradle/publishing/maven.gradle.kts[tags=upload]
include::../gradle/publishing/maven-publish.gradle.kts[tags=publishing]
----



[[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:
[[publishing-your-application-maven]]
=== Publishing with the Maven Plugin
WARNING: The `maven` plugin has been deprecated in Gradle 6 and has been removed in Gradle 7.
Please use the `maven-publish` plugin instead.

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-publish.gradle[tags=publishing]
include::../gradle/publishing/maven.gradle[tags=upload]
----

[source,kotlin,indent=0,subs="verbatim,attributes",role="secondary"]
.Kotlin
----
include::../gradle/publishing/maven-publish.gradle.kts[tags=publishing]
include::../gradle/publishing/maven.gradle.kts[tags=upload]
----


Expand Down

0 comments on commit 08802d3

Please sign in to comment.