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.
JDK compatibility
From version 3.0.0, the plugin no longer supports building with JDK 7.
Maven Compatibility
The minimum Maven version supported is 3.3.9
Integration Benefits JFrog Artifactory and Maven
Configuring Maven Projects
Once you have at least one Artifactory server configure, you can configure your Maven builds using the following 3 steps:
Resolve Artifacts from Artifactory
Deploy Artifacts to Artifactory
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.
Field | Description |
---|---|
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.
Field | Description |
---|---|
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
Field | Description |
---|---|
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.