Defining artifacts

In the previous section, you learned that the Java plugin adds an archives configuration that is used to group artifacts from the project. Just as we created configurations for dependencies in our project, we can also create our own configurations for its artifacts. To assign an archive or file to this configuration, we must use the artifacts configuration block in our build script. Inside the configuration closure, we use the name of the configuration followed by the artifact. We can also further customize the artifact definition inside the artifacts block.

We can define artifacts with the following three types:

Type

Description

AbstractArchiveTask

The information for the artifact is extracted from the archive task. The ...

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.