Skip to content

Latest commit

 

History

History
84 lines (54 loc) · 4.43 KB

README.md

File metadata and controls

84 lines (54 loc) · 4.43 KB

Gradle Artifactory Plugin Examples

Overview

The Gradle Artifactory Plugin allows you to deploy your build artifacts and build information to Artifactory and also to resolve your build dependencies from Artifactory. The Plugin documentation is available here. We have included a few sample projects to help you get started using the plugin.

Running the Examples

  • The example projects are configured to work with an Artifactory instance accessed through the following URL:
    http://localhost:8081/artifactory
    This URL is defined inside the build.gradle file of each project. Please change it if your Artifactory instance is accessible through a different URL.
  • Configure your Artifactory username and password in the gradle.properties file for each project
  • Since all example projects are configured to deploy artifacts to 'libs-snapshot-local' repository, it is recommended to create a local repository named libs-snapshot-local or change it inside the build.gradle file of each project.
  • Since all example projects are configured to resolve dependencies from 'Maven Central', it is recommended to create a remote repository named mvn-central, which proxies https://repo1.maven.org/maven2 as its URL.
  • CD to one of the project's root directory and run the build using one of the following commands:
> gradle artifactoryPublish

or with the gradle wrapper in Unix

> ./gradlew artifactoryPublish

and the gradle wrapper in Windows

> gradlew.bat artifactoryPublish

About the Examples

gradle-example-minimal

A minimal sample project that uses the Gradle Artifactory Plugin to resolve and publish artifacts to Artifactory.

gradle-example-ci-server

Gradle sample project to be used with one of the Artifactory CI clients or plugins:

The Artifactory configuration in this case (repositories, Artifactory credentials, etc.) is done from the CI client UI. You can still add the artifactory closure to the build script and have default values configured there, but the values configured in the CI Server override them. In this example, the only Artifactory property configured is "artifactoryPublish.skip = true".

Important notes for using this example from a CI Server:

  • Make sure to have the "Project uses the Artifactory Gradle Plugin" check box in the CI Server UI unchecked, so that the CI Server Plugin automatically applies the Gradle Artifactory Plugin to your build script.
  • In order to publish the build artifacts to Artifactory, the published artifacts are added to the archives Gradle configuration.

gradle-example-publish

Sample project that uses the Gradle Artifactory Plugin with Gradle Publications.

gradle-kts-example-publish

Sample project that configures the Gradle Artifactory Plugin with the Gradle Kotlin DSL.

gradle-android-example

Sample project that uses the Gradle Artifactory Plugin to deploy Android application (apk) and library (aar) to Artifactory.

Compatible with Android gradle plugin version 3.0.x

gradle-android-library-ci-server

Sample project that uses the Gradle Artifactory Plugin to deploy Android library (aar) to Artifactory using one of the Artifactory CI clients or plugins.

Read more information about Artifactory as a Gradle repository and the Gradle Artifactory Plugin. Also read about JFrog CLI's integration with Gradle and Maven.

gradle-version-catalog-example

Sample projects that use the JFrog CLI to share a Version Catalog file in JFrog Artifactory.