Gradle Artifacts: Difference between revisions

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


A Gradle project may produce zero, one or more [[#Artifact|artifacts]]. An artifact may be built locally by a plugin such as the [[Gradle_Application_Plugin#Overview|Application plugin]], which in turn delegates the artifact building part to [[Gradle_Distribution_Plugin#Overview|Distribution plugin]], or by other plugins. The artifact building plugins create the artifact locally, in the project build area. This article describes the process of configuring and executing the artifact generation. For details on how the artifacts can be published, see: {{Internal|Gradle_Artifact_Publishing_Concepts#Overview|Gradle Artifact Publishing Concepts}}
A Gradle project may produce zero, one or more [[#Artifact|artifacts]]. An artifact may be built locally by a plugin such as, for example, the [[Gradle_Application_Plugin#Overview|Application plugin]], which in turn delegates the artifact building part to [[Gradle_Distribution_Plugin#Overview|Distribution plugin]], or by other plugins. The artifact building plugins create the artifact locally, in the project build area. This article describes the process of configuring and executing the artifact generation. For details on how the artifacts can be published, see: {{Internal|Gradle_Artifact_Publishing_Concepts#Overview|Gradle Artifact Publishing Concepts}}


=Artifact=
=Artifact=


A Gradle artifact is a file the project builds and shares with the outside world.
A Gradle artifact is a file or a directory produced by the build and intended to be shared with the outside world. Artifacts are typically designed to be used or consumed by users or other projects, or deployed to hosting systems. In such cases, the artifact is a single file. Directories are common in the case of inter-project dependencies to avoid the cost of packaging the publishable artifact.


Typical artifacts:
Typical artifacts:
* A library JAR that includes the functionality exposed by the Java project. Additionally, the project may produce companion JARs that bundle the source files.
* A library JAR that includes the functionality exposed by the Java project. Additionally, the project may produce a companion JAR that bundles the source files. Java projects - those who apply the [[Gradle_Java_Plugin#Artifacts|Java plugin]] - produce JARs by default with little to none configuration. The mechanics of producing the bytecode and source JAR files, as well as configuration elements are described in the [[Gradle_Java_Plugin#jar|Gradle Java plugin "jar" task]] section.
* An executable JVM application that bundles all application JARS, transitive dependencies, the bash wrapper scripts and other operating system specific scripts into a ZIP file. This type of artifact is produced by the [[Gradle_Application_Plugin#Overview|Application plugin]] in cooperation with the [[Gradle_Distribution_Plugin#Overview|Distribution plugin]].
* An executable JVM application that bundles all application JARS, transitive dependencies, the bash wrapper scripts and other operating system specific scripts into a ZIP file. This type of artifact is produced by the [[Gradle_Application_Plugin#Overview|Application plugin]] in cooperation with the [[Gradle_Distribution_Plugin#Overview|Distribution plugin]].
* A Docker image that is assembled by the project then pushed into a repository.
* A Docker image that is assembled by the project then pushed into a repository.


=Artifact Plugins=
=Artifact Plugins=
* [[Gradle_Java_Plugin#jar|The "jar" task fo the Java Plugin]]
* <span id='The_Application_Plugin'></span>[[Gradle Application Plugin#Overview|Application Plugin]]
* <span id='The_Application_Plugin'></span>[[Gradle Application Plugin#Overview|Application Plugin]]
* <span id='The_Distribution_Plugin'></span>[[Gradle Distribution Plugin#Overview|Distribution Plugin]]
* <span id='The_Distribution_Plugin'></span>[[Gradle Distribution Plugin#Overview|Distribution Plugin]]

Latest revision as of 01:25, 24 February 2019

Internal

Overview

A Gradle project may produce zero, one or more artifacts. An artifact may be built locally by a plugin such as, for example, the Application plugin, which in turn delegates the artifact building part to Distribution plugin, or by other plugins. The artifact building plugins create the artifact locally, in the project build area. This article describes the process of configuring and executing the artifact generation. For details on how the artifacts can be published, see:

Gradle Artifact Publishing Concepts

Artifact

A Gradle artifact is a file or a directory produced by the build and intended to be shared with the outside world. Artifacts are typically designed to be used or consumed by users or other projects, or deployed to hosting systems. In such cases, the artifact is a single file. Directories are common in the case of inter-project dependencies to avoid the cost of packaging the publishable artifact.

Typical artifacts:

  • A library JAR that includes the functionality exposed by the Java project. Additionally, the project may produce a companion JAR that bundles the source files. Java projects - those who apply the Java plugin - produce JARs by default with little to none configuration. The mechanics of producing the bytecode and source JAR files, as well as configuration elements are described in the Gradle Java plugin "jar" task section.
  • An executable JVM application that bundles all application JARS, transitive dependencies, the bash wrapper scripts and other operating system specific scripts into a ZIP file. This type of artifact is produced by the Application plugin in cooperation with the Distribution plugin.
  • A Docker image that is assembled by the project then pushed into a repository.

Artifact Plugins