Have a question? Want to report an issue? Contact JFrog support

Skip to end of metadata
Go to start of metadata

Overview

The Jenkins Artifactory Plugin supports Maven build projects, allowing your build jobs deploy artifacts and resolve dependencies to and from Artifactory, and then have them linked to the build job that created them.

As described below, using the Jenkins Maven Plugin, you can create either a specific Maven build project, or a freestyle project with Artifactory Maven integration.

Page Contents

Integration Benefits


Configuring Maven Projects

Once you have at least one Artifactory server configure, you can configure your Maven builds using the following 3 steps:

  1. Resolve Artifacts from Artifactory
  2. Deploy Artifacts to Artifactory
  3. Allow release management (in the Build Environment section, check "Enable Artifactory release management". Additional info here

Resolve Artifacts from Artifactory

To resolve artifacts from Artifactory, in the Build Environment section, check "Resolve artifacts from Artifactory"

Resolve artifacts from Artifactory, can be distinguish between repositories that resolves Snapshot artifacts and repositories that resolves Release artifacts.

Artifactory server
Artifactory server as defined in the Artifactory plugin configuration. The selected server will be used for artifacts resolution and build info deployment.
Resolution releases repository
Repository used to download released artifacts from.
Resolution snapshots repository
Repository used to download snapshot artifacts from.
Override default credentials
Override default credentials.

Deploy Artifacts to Artifactory


To deploy artifacts to Artifactory, in the Post build Actions section, add a "Deploy artifacts to Artifactory" post build action.

Artifactory Server
Artifactory server as defined in the Artifactory plugin configuration. The selected server will be used for artifacts resolution and build info deployment.
Target releases repository

Repository to deploy release artifacts to.

Using the text mode will enable you to also use placeholders for environment variable which will be replaced with your environment value at build time.

Target snapshot repository

Repository to deploy snapshots artifacts to. 

Using the text mode will enable you to also use placeholders for environment variable which will be replaced with your environment value at build time

Custom staging configuration
Select a named staging configuration defined by an Artifactory User Plugin or select "None" to use the default staging settings.
Override default credentials
Override default credentials.
Deploy even if the build is unstable

Perform deployment even if the build is unstable.

Override build name

Override Artifactory default build name.

Deploy maven artifacts

Publish produced build artifacts to Artifactory.

Capture and publish build info

Publish build information to Artifactory.

Enable isolated resolution for downstream builds (requires Artifactory Pro)

When checked, a build parameter named ARTIFACTORY_BUILD_ROOT with a value of ${JOB_NAME}-${BUILD_NUMBER} will be sent to downstream builds.

For example: ARTIFACTORY_BUILD_ROOT=Infrastructure-1025. The value of the parameter is also attached to published artifacts as the property: build.root as a matrix parameter on the deployment URL.

Downstream builds will add build.root=${ARTIFACTORY_BUILD_ROOT} as a matrix parameter to their Artifactory resolution URL

For example: build.root=Infrastructure-1025 to achieve isolated resolution from Artifactory and only resolve artifacts produced by the root build that triggered it, avoiding any artifacts produced by other runs that are out of the build chain.

Build Configuration

The build Goals and options should be set to clean install

Maven Version
The Maven version.
Root POM
If your workspace has the top-level pom.xml in somewhere other than the 1st module's root directory, specify the path (relative to the module root) here, such as parent/pom.xml
If left empty, defaults to pom.xml
Goals and options

Specifies the goals to execute, such as "clean install" or "deploy". This field can also accept any other command line options to Maven, such as "-e" or "-Djava.net.preferIPv4Stack=true".


Configuring Freestyle Maven 3 Projects 

The Jenkins Artifactory plugin supports running Maven 3 builds from freestyle projects by using a Maven 3 build step + a build environment section for the Artifactory Maven 3 integration (artifact and build information deployment). However, users are encouraged to configure the Artifactory integration using Jenkins Maven Project.


Artifactory Server
Artifactory server as defined in the Artifactory plugin configuration. The selected server will be used for artifacts and build info deployment.
Target releases repository

Repository to deploy release artifacts to.

Using the text mode will enable you to also use placeholders for environment variable which will be replaced with your environment value at build time.

Target snapshot repository

Repository to deploy snapshots artifacts to. 

Using the text mode will enable you to also use placeholders for environment variable which will be replaced with your environment value at build time.

Override default credentials
Override default credentials.
Resolve artifacts from Artifactory

Check if you wish all dependency resolution to go through Artifactory.

Using the text mode will enable you to also use placeholders for environment variable which will be replaced with your environment value at build time.

Notice: this will override any external repository definition in Maven settings or POM files.

Override build name

Override Artifactory default build name.

Deploy artifacts to Artifactory

Check if you wish to publish produced build artifacts to Artifactory.

Filter excluded artifacts from build info
Add the excluded files to the excludedArtifacts list and remove them from the artifacts list in the build info.
Capture and publish build info

Publish build information to Artifactory.

Include environment variables

Check if you wish to include all environment variables accessible by the builds process. Jenkins-specific EnvVars are always included. Note: including all environment variables as part of the captured build information may result in very large build objects and may slow down deployment.

Record implicit project dependencies and build-time dependencies

Check if you wish build information published to Artifactory to include implicit project dependencies
(for example, poms and parent poms of the project dependencies)
as well as build-time dependencies (for example, maven plugins used during the build).

Discard old builds from Artifactory (requires Artifactory Pro)
Automatically remove old builds stored in Artifactory according to Jenkins’s configured policy for discarding old builds.




  • No labels