Setting Up Maven Builds for Pipelines

JFrog Pipelines Documentation

JFrog Pipelines
Content Type
User Guide

If you are already using the Maven Artifactory Plugin, your Maven projects will need some additional configuration for use within a Pipeline. Note that Pipelines does not require this plugin and configuration may be simpler without it, but if your project is already using the plugin, then you can configure your pipeline to do the same.Ecosystem Integration

The plugin is used to automatically resolve dependencies, deploy artifacts, and publish builds when running a mvn build command. The procedures shown here enables the plugin to access Artifactory through the credentials stored in the Artifactory Integration or JFrog Platform Access Token Integration that is used by your pipeline.


First, configure the Project Object Model{pom.xml) configuration file of your Maven project to use the Maven Artifactory Plugin.Ecosystem Integration - Maven Artifactory Plugin

The Maven Artifactory Plugin will need to know your Artifactory credentials to be able to publish your Maven builds to repositories. You can provide this information in the Maven project's pom.xml configuration file, in the publisher block along with the names of the repositories where artifacts are to be published.

  <contextUrl> .. </contextUrl>
  <username> .. </username>
  <password> .. </password>
  <repoKey> .. </repoKey>
  <snapshotRepoKey> .. </snapshotRepoKey>

To keep this credential information secure, your pom.xml should reference these values as system properties that you have defined in your Maven project's settings.xml configuration file.

For even greater security, you should declare those properties in settings.xml using the environment variables provided by the Artifactory Integration or JFrog Platform Access Token Integration to the step's execution environment. This also makes your Maven project adaptable to Pipelines – you can change which Artifactory instance is used in your pipeline without having to change your Maven project.

For example, this settings.xml file references the credentials and URL stored in the MyArtifactory integration:




Note that the MyArtifactory integration must have been specified in the step's integrations tag (required for the MvnBuild native step) for these environment variables to be available to the step's execution environment.

Once defined in settings.xml, these properties can then be referenced in the pom.xml configuration file: