Gradle Maven Plugin: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
=External=
* https://docs.gradle.org/current/userguide/maven_plugin.html


=Internal=
=Internal=


* [[Gradle_Concepts#Maven_Plugin|Gradle Concepts]]
 
* [[Gradle_Artifact_Publishing_Concepts#Publishing_to_a_Maven_Repository|Gradle Artifact Publishing Concepts]]


=Overview=
=Overview=
Line 10: Line 13:
apply plugin: 'maven'
apply plugin: 'maven'
</syntaxhighlight>
</syntaxhighlight>
The Maven plugin define an "install" task of type "Upload". It installs the associated artifacts to the local Maven cache, including the Maven metadata. By default, the task is associated with the "[[Gradle_Java_Plugin#archives|archives]]" configuration. Additionally to installing artifacts into the local Maven cache (repository), the plugin can upload to remote Maven repositories.
{{Note|Publishing with Maven plugin has been obsoleted by [[Gradle_Maven_Publish_Plugin#Overview|maven-publish Plugin]], use that instead whenever possible.}}
=Declaring an Artifact=
{{External|https://docs.gradle.org/current/userguide/artifact_management.html#sec:archive_task_artifacts}}
=Publishing an Artifact=
{{External|https://docs.gradle.org/current/userguide/artifact_management.html#sec:publishing_artifacts}}
=POM Generation=
{{External|https://docs.gradle.org/current/userguide/maven_plugin.html#sec:maven_pom_generation}}


=Publishing to a Maven Repository=
=Publishing to a Maven Repository=


Gradle can be configured to [[Gradle_Concepts#Artifact_Publishing|publish artifacts]] to a Maven repository by configuring Maven plugin's uploadArchive task In [[build.gradle]]:
{{External|https://docs.gradle.org/current/userguide/maven_plugin.html#uploading_to_maven_repositories}}
 
Gradle can be configured to [[Gradle_Artifact_Publishing_Concepts#Publishing_to_a_Maven_Repository|publish artifacts]] to a Maven repository by configuring Maven plugin's uploadArchive task In [[Gradle_Project_and_Build_Script#Overview|build.gradle]]:


<syntaxhighlight lang='groovy'>
<syntaxhighlight lang='groovy'>

Latest revision as of 01:37, 4 October 2020

External

Internal

Overview

apply plugin: 'maven'

The Maven plugin define an "install" task of type "Upload". It installs the associated artifacts to the local Maven cache, including the Maven metadata. By default, the task is associated with the "archives" configuration. Additionally to installing artifacts into the local Maven cache (repository), the plugin can upload to remote Maven repositories.


Publishing with Maven plugin has been obsoleted by maven-publish Plugin, use that instead whenever possible.

Declaring an Artifact

https://docs.gradle.org/current/userguide/artifact_management.html#sec:archive_task_artifacts

Publishing an Artifact

https://docs.gradle.org/current/userguide/artifact_management.html#sec:publishing_artifacts

POM Generation

https://docs.gradle.org/current/userguide/maven_plugin.html#sec:maven_pom_generation

Publishing to a Maven Repository

https://docs.gradle.org/current/userguide/maven_plugin.html#uploading_to_maven_repositories

Gradle can be configured to publish artifacts to a Maven repository by configuring Maven plugin's uploadArchive task In build.gradle:

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "file://localhost/tmp/myRepo/")
        }
    }
}