We must add the
maven-publish plugin to our project to add the new publication feature of Gradle. The plugin allows us to define and deploy our project artifacts in the Maven format. This means our deployed project can be used by other developers and projects that support the Maven format. For example, other projects could use Gradle or Maven and define a dependency to our published artifacts.
maven-publish plugin is based on a general
publishing plugin. The
publishing plugin adds a new
publishing extension to our project. We can use a
publications configuration block in our build script to configure the artifacts we want to publish and the repositories we want to deploy to. The
publications extension has the
PublishingExtension type in the
org.gradle.api.publish package. The plugin also adds the general life cycle
publish task to the project. Other tasks can be added as task dependencies to this task; thus, with a single
publish task, all the publications in the...