Book Image

Mastering Gradle

Book Image

Mastering Gradle

Overview of this book

Table of Contents (17 chapters)
Mastering Gradle
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Publishing artifacts


Until now, we have discussed a lot about dependencies. How we can define project dependencies, customize them, and configure repositories to download libraries. Now, let's try to build the artifacts (JAR, WAR, and so on) and publish it to Artifact repositories (could be a local filesystem, remote location, or Maven repository) to make it available to all the other teams to share.

Default artifacts

When we apply the Java plugin, Gradle adds some default configuration to the project such as compile, runtime, testCompile. The Java plugin also adds one more configuration archive, which is used to define the artifacts of your project. Gradle provides the default artifact with some of the plugins. For example, Java, Groovy plugin publishes JAR as a default artifact, war plugin publish WAR as a default artifact. This JAR can be uploaded or published to a repository using the uploadArchives task.

The following code snippet shows how to configure the repository to upload archives...