Gradle Artifact Publishing Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
=External=


* https://docs.gradle.org/current/userguide/publishing_overview.html
* https://docs.gradle.org/current/userguide/artifact_management.html
* https://docs.gradle.org/current/userguide/artifact_management.html
* https://docs.gradle.org/current/userguide/publishing_maven.html
* https://docs.gradle.org/current/userguide/publishing_maven.html
Line 13: Line 14:
=Overview=
=Overview=


Publishing plugins, such as Maven, define [[Gradle_Maven_Plugin#Publishing_to_a_Maven_Repository|publishing tasks]], that can be configured in [[Gradle_Project_and_Build_Script#Overview|build.gradle]].
Publishing plugins, such as [[Gradle_Maven_Plugin#Overview|Maven]] and [[Gradle_Maven_Publish_Plugin#Overview|Maven Publish]], define [[Gradle_Maven_Plugin#Publishing_to_a_Maven_Repository|publishing tasks]], which then can be configured in build scripts and used to publish artifacts.  


=Artifact=
<font color=darkgray>Is the following relevant to [[Gradle_Maven_Publish_Plugin#Overview|Maven Publish]], or only to [[Gradle_Maven_Plugin#Overview|Maven]]?</font> <span id='Configuration'></span><span id='Dependency_Configuration'></span>The [[Gradle_Dependencies_and_Dependency_Configurations#Dependency_Configuration|Gradle '''dependency configurations''']] are also used to specify publishing artifacts. There are two configurations introduced by the [[Gradle_Java_Plugin#Overview|Java plugin]] that are relevant to artifact generation and publishing: [[Gradle_Java_Plugin#archives|archives]] and [[Gradle_Java_Plugin#runtime|runtime]]. Their relationship with artifact publishing is explained in the [[Gradle_Java_Plugin#Overview|Java plugin]] page. Any custom archive created as part of the build are not automatically assigned to any configuration. If such as assignment is desired, it will have to be explicitly declared.


Projects use Gradle to produce artifacts, also referred to as ''publication artifacts''.  Artifacts of a project are the files the project provides to the outside world.
=<span id='Artifact'>Publication Artifact=
 
When the [[Gradle_Concepts#Artifact|artifacts]] produced by Gradle need to be published in an external repository, they are referred to as '''publication artifacts'''.


==Extension==
==Extension==


{{Internal|Maven_Concepts#Type_2|Maven 'extension'}}
{{Internal|Maven_Concepts#Type_2|Maven 'extension'}}
Publishing plugin allow it to be [[Gradle_Maven_Publish_Plugin#Custom_Artifact_Publication|configured]].


==Classifier==
==Classifier==


{{Internal|https://kb.novaordis.com/index.php/Maven_Concepts#Classifier|Maven 'classifier'}}
{{Internal|Maven_Concepts#Classifier|Maven 'classifier'}}
 
=<span id='Configuration'></span>Dependency Configuration=


The [[Gradle_Dependencies_and_Dependency_Configurations#Dependency_Configurationn|configurations used to specify dependencies]] are also used to specify publishing artifacts. There are two configurations introduced by the [[Gradle_Java_Plugin#Overview|Java plugin]] that are relevant to artifact generation and publishing: [[Gradle_Java_Plugin#archives|archives]] and [[Gradle_Java_Plugin#runtime|runtime]]. Their relationship with artifact publishing is explained in the [[Gradle_Java_Plugin#Overview|Java plugin]] page. Any custom archive created as part of the build are not automatically assigned to any configuration. If such as assignment is desired, it will have to be explicitly declared.
Publishing plugin allow it to be [[Gradle_Maven_Publish_Plugin#Custom_Artifact_Publication|configured]].


=Declaring an Artifact=
=Publishing to a Maven Repository=


{{External|https://docs.gradle.org/current/userguide/artifact_management.html#sec:archive_task_artifacts}}
There are two plugins that can be used to publish to a Maven repository: [[Gradle_Maven_Plugin#Overview|Maven]] and [[Gradle_Maven_Publish_Plugin#Overview|Maven Publish]]. Gradle 1.3 and newer makes [[Gradle_Maven_Publish_Plugin#Overview|Maven Publish]] available. For pre-1.3 Gradle, only [[Gradle_Maven_Plugin#Overview|Maven]] can be used to publish.


=Publishing an Artifact=
==Publishing with Maven Publish in Gradle 1.3 and Newer==


{{External|https://docs.gradle.org/current/userguide/artifact_management.html#sec:publishing_artifacts}}
{{Internal|Gradle_Maven_Publish_Plugin#Overview|Publishing to a Maven Repository with Maven Publish Plugin}}


==Publishing to a Maven Repository==
==Publishing with Maven Before Gradle 1.3==


* Gradle 1.3 and newer: [[Gradle_Maven_Publish_Plugin#Publishing_to_a_Maven_Repository|Publishing to a Maven Repository with maven-publish Plugin]]
{{Internal|Gradle_Maven_Plugin#Publishing_to_a_Maven_Repository|Publishing to a Maven Repository with Maven Plugin}}
* Pre-Gradle 1.3 Way: [[Gradle_Maven_Plugin#Publishing_to_a_Maven_Repository|Publishing to a Maven Repository with Maven Plugin]]

Latest revision as of 01:05, 24 February 2019

External

Internal

Overview

Publishing plugins, such as Maven and Maven Publish, define publishing tasks, which then can be configured in build scripts and used to publish artifacts.

Is the following relevant to Maven Publish, or only to Maven? The Gradle dependency configurations are also used to specify publishing artifacts. There are two configurations introduced by the Java plugin that are relevant to artifact generation and publishing: archives and runtime. Their relationship with artifact publishing is explained in the Java plugin page. Any custom archive created as part of the build are not automatically assigned to any configuration. If such as assignment is desired, it will have to be explicitly declared.

Publication Artifact

When the artifacts produced by Gradle need to be published in an external repository, they are referred to as publication artifacts.

Extension

Maven 'extension'

Publishing plugin allow it to be configured.

Classifier

Maven 'classifier'

Publishing plugin allow it to be configured.

Publishing to a Maven Repository

There are two plugins that can be used to publish to a Maven repository: Maven and Maven Publish. Gradle 1.3 and newer makes Maven Publish available. For pre-1.3 Gradle, only Maven can be used to publish.

Publishing with Maven Publish in Gradle 1.3 and Newer

Publishing to a Maven Repository with Maven Publish Plugin

Publishing with Maven Before Gradle 1.3

Publishing to a Maven Repository with Maven Plugin