Using the latest version?
JFrog Platform User Guide

Skip to end of metadata
Go to start of metadata


Artifactory supports Maven builds on commonly used build servers such as JenkinsTeamCity and Bamboo through corresponding plugins for these CI servers. However, in the last few years, the popularity of cloud-based build servers has grown spawning products like Travis and Codeship. The problem, is that none of these are "pluggable" in the traditional way. Therefore, to support Maven builds running on cloud-based build servers, you can use the Maven Artifactory Plugin.

You can use the Maven Artifactory plugin if a plugin for your CI server is not available (for example, cloud-based CI servers), or if you have very specific needs that are not supported by your CI server plugin.

Use only one plugin

However your build ecosystem is set up, make sure that you are only using one of the Artifactory plugins (either for your CI server, or for your build tool) to avoid clashing instructions and duplicated builds.

Source Code Available!

The Maven Artifactory Plugin is an open-source project on GitHub which you can freely browse and fork.

Page Contents


Through the Maven Artifactory Plugin, Artifactory is fully integrated with Maven builds and allows you to do the following:

  1. Attach properties to published artifacts in Artifactory metadata.
  2. Capture a BuildInfo object which can be passed to the Artifactory REST API to provide a fully traceable build context.
  3. Automatically publish all build artifacts at the end of the build.


The Maven Artifactory Plugin coordinates are org.jfrog.buildinfo:artifactory-maven-plugin:2.6.1. It can be viewed on Bintray, and can be download via the JCenter Repository

A typical build plugin configuration would be as follows:


The plugin's invocation phase is "validate" by default and we recommend you don't change it so the plugin is called as early as possible in the lifecycle of your Maven build.


The example above configures the Artifactory publisher,  to deploy build artifacts either to the releases or the snapshots repository of the  public OSS instance of Artifactory when mvn deploy is executed. 

However, the Maven Artifactory Plugin provides many other configurations which you can see by running mvn -X validate and are displayed below:

<deployProperties> .. </deployProperties>
  <envVarsExcludePatterns> .. </envVarsExcludePatterns>
  <envVarsIncludePatterns> .. </envVarsIncludePatterns>
  <contextUrl> .. </contextUrl>
  <username> .. </username>
  <password> .. </password>
  <repoKey> .. </repoKey>
  <snapshotRepoKey> .. </snapshotRepoKey>
  <excludePatterns> .. </excludePatterns>
  <includePatterns> .. </includePatterns>
  <!-- If true build information published to Artifactory will include implicit project as well as build-time dependencies -->
  <agentName> .. </agentName>
  <agentVersion> .. </agentVersion>
  <buildName> .. </buildName>
  <buildNumber> .. </buildNumber>
  <buildNumbersNotToDelete> .. </buildNumbersNotToDelete>
  <buildUrl> .. </buildUrl>
  <principal> .. </principal>
  <vcsRevision> .. </vcsRevision>
  <scopes> .. </scopes>
  <violationRecipients> .. </violationRecipients>
  <appName> .. </appName>
  <appVersion> .. </appVersion>
  <reportRecipients> .. </reportRecipients>
  <scopes> .. </scopes>

Specifies properties you can attach to published artifacts. For example:

 Specifies whether environment variables are published as part of BuildInfo metadata and which include or exclude patterns are applied when variables are collected

Defines an Artifactory repository where build artifacts should be published using a combination of a <contextUrl> and <repoKey>/<snapshotRepoKey>.

Build artifacts are deployed if the deploy goal is executed and only after all modules are built

Updates BuildInfo metadata published together with build artifacts. You can configure whether or not BuildInfo metadata is published using the <publisher> configuration.
Controls auto-discovery and violation monitoring of third-party licenses
Configures Artifactory BlackDuck integration. Note that you need to specify <runChecks>true</runChecks> to activate it.  

Reading Environment Variables and System Properties

Every build server provides its own set of environment variables. You can utilize these variables when configuring the plugin as shown in the following example:



Any plugin configuration value can contain several {{ .. }} expressions. Each expression can contain a single or multiple environment variables or system properties to be used.

The expression syntax allows you to provide enough variables to accommodate any build server requirements according to the following rules:

  • Each expression can contain several variables, separated by a  ' | ' character to be used with a configuration value
  • The last value in a list is the default that will be used if none of the previous variables is available as an environment variable or a system property

For example, for the expression {{V1|V2|"defaultValue"}} the plugin will attempt to locate environment variable V1, then system property V1, then environment variable or system property V2, and if none of these is available, "defaultValue" will be used. 

If the last value is not a string (as denoted by the quotation marks) and the variable cannot be resolved, null will be used (for example, for expression {{V1|V2}} where neither V1 nor V2 can be resolved).  

You can attach additional artifacts to your module using the Build Helper Maven Plugin.

Keeping your Artifactory publisher credentials secure

If you prefer to keep your Artifactory publisher credentials (username and password) secure (rather than providing them as free text in the plugin configuration), we recommend storing them as environment variables or system properties and have the plugin read them when needed. Since the usual Maven deploy does not support environment variables or system properties in settings.xml, this capability is unique to the Maven Artifactory Plugin.



The below project provides a working example of using the plugin:




  • No labels