With Artifactory's Gradle Build Script Generator, you can easily create a Gradle init script that handles resolution.
In the Artifact Repository Browser of the Artifacts module, select Set Me Up. In the Set Me Up dialog, set Gradle in the Tool field and click "Generate Gradle Settings". You can now specify the settings you want to configure for Gradle.
Plugin/Libs Resolver | The repository that should be used to resolve plugins/libraries |
Use Maven/Use Ivy | When checked, specifies that resolving should be done using the Maven/Ivy pattern |
Libs Publisher | The repository that should be used to publish libraries |
Use Maven/Use Ivy | When checked, specifies that library should be published using a Maven/Ivy descriptor |
Repository Layout | Specifies the layout of the corresponding repository |
Once you have configured the settings for Gradle you can click "Generate Settings" to generate and save the build.gradle and gradle.properties
file.
Artifactory lets you deploy and provision a dynamic settings template for your users. Once downloaded, settings are generated according to your own logic and can automatically include user authentication information.
For more details, please refer to Provisioning Build Tool Settings section under Filtered Resources.
You can download sample scripts from the JFrog.
For Gradle to build your project and upload generated artifacts to Artifactory, you need to run the following command:
gradle artifactoryPublish |
For more details on building your projects with Gradle, please refer to the .
We highly recommend running Gradle with the |
Artifactory can provide you with dependency declaration code snippets that you can simply copy into the Gradle Dependency Declaration section of your build.gradle
file.
In the Artifact Repository Browser of the Artifacts module, drill down in the repository tree and select a relevant artifact. Under the Dependency Declaration section, select Gradle to display the corresponding dependency declaration that you can copy into your build.gradle
file.
From V3.5, Gradle introduces a build cache feature that lets you reuse outputs produced by other builds, instead of rebuilding them, and dramatically reduce build time. This feature supports not only your local filesystem cache, but also remote caches that can be shared across your organization.
The Gradle team has measured an average |
To optimize your Gradle builds:
Artifactory can be used as the Gradle build cache by simply creating a generic repository in Artifactory.
For example, the following is a where the CI server builds a project and stores the build cache in Artifactory for later use by the following builds. This will greatly improve the build time in your local developer environments.
Configure Gradle to use the build cache and point it to Artifactory.
gradle.properties
artifactory_user=admin artifactory_password=password artifactory_url=http://localhost:8081/artifactory org.gradle.caching=true gradle.cache.push=false |
settings.gradle
Set the gradle.cache.push property to true, on the CI server, by overriding it using -Pgradle.cache.push=true.
include "shared", "api", "services:webservice" ext.isPush = getProperty('gradle.cache.push') buildCache { local { enabled = false } remote(HttpBuildCache) { url = "${artifactory_url}/gradle-cache-example/" credentials { username = "${artifactory_user}" password = "${artifactory_password}" } push = isPush } } |
You can also use Artifactory as a distributed cache that’s synchronized across both local and remote teams using push and pull repository replication, and improve both your local and remote build times.
<iframe width="560" height="315" src="https://www.youtube.com/embed/Vg63uHLKW_0" frameborder="0" allowfullscreen></iframe> |