Defining publication artifacts

A publication we define must have a unique name in our project. We can add multiple publications with their own name inside a publications configuration block. To add an artifact, we can use the artifact method in the publication definition. We can also use the artifacts property to directly set all artifacts.

We can define the artifact with the artifact method in the ways described in the following table:

Type

Description

AbstractArchiveTask

The information for the artifact is extracted from the archive task. The artifact is an instance of PublishArtifact in the org.gradle.api.artifacts package.

File

The information for the artifact is extracted from the filename.

Map

This is another way to define artifacts. ...

Get Gradle Dependency Management now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.