Using the Artifactory Plugin DSL
The Gradle Artifactory plugin is configured using its own Convention DSL inside the
build.gradle script of your root project.
The syntax of the Convention DSL is described below:
We highly recommend also using our examples as a reference when configuring the DSL in your build scripts.
Mandatory items within the relevant context are prefixed with '+'. All other items are optional.
Follow this documentation for different ways to configure your repositories.
Controlling how environment variables are exposed
As shown in the example above, you can control which environment variables are exposed in
clientConfig.setEnvVarsIncludePatterns. These calls specify which environment variables should be excluded or included respectively using a parameter which is a comma-separated list of expressions to exclude or include. The expressions can use a star ('*') wildcard to specify multiple environment variables.
The Artifactory Project Publish Task
The Artifactory Publishing Plugin creates an
artifactoryPublish Gradle task for each project the plugin is applied to. The task is configured by the
publish closure of the plugin.
You can configure the project-level task directly with the task's
artifactoryPublish closure, which uses identical Syntax to that of the plugin's
Controlling Publication in Sub-Projects
The Gradle Artifactory Plugin allows you to define different publication configuration for sub projects. You may also define the configuration once for the whole project by defining the artifactory closure only in the root project. The plugin also lets you disable publication for a sub-module.
- When defining the configuration anywhere in the hierarchy, all sub-projects beneath it inherit the configuration and can override it whether it is defined in the root or in a sub-project.
Each sub-project can override the
publishclosure or the repositories closure, or both of them.
For buildInfo to be published, a publish closure must be defined in the root project.
- Use the
artifactoryPublish.skipflag to deactivate analysis and publication.
Activate the corresponding
artifactoryPublishGradle task manually for each project to which you wish to apply the plugin. For example in our Gradle project example you can run:
Controlling the Build Name and Number
By default, BuildInfo is published with a build name constructed from the name of your root project and a build number that is the start date of the build.
You can control the build name and number values by specifying the following properties respectively:
The above properties should be added to your project's gradle.properties file.
Using HTTP proxy
For deployment, add the following fields to the Artifactory closure in the
The Artifactory Gradle plugin does not intervene in the Gradle dependency resolution process. Therefore to resolve the Gradle dependencies, use the regular Gradle proxy configuration configured in the
Project examples which use the Gradle Artifactory Plugin are available here.