Using Properties in Deployment and Resolution

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide

Matrix parameters are key-value pair parameters separated by a semicolon (;) that you can place anywhere in a URI. Matrix URI is a method for specifying parameters in HTTP, in addition to querying parameters and path parameters. You can use matrix parameters in Artifactory to add properties to artifacts as part of deployment, and to control artifact resolution.

For example, note the matrix parameters status=DEV and rating=5 in the following URL:

http://repo.jfrog.org/artifactory/libs-releases-local/org/libs-releases-local/org/jfrog/build-info-api/1.3.1/build-info-api-1.3.1.jar;status=DEV;rating=5

These parameters add specifications for artifact resolution or deployment.

For deployment, you can add key-value matrix parameters to deploy (PUT) requests. If you add matrix parameters to the target deployment base URL, the artifact path is added after the matrix parameters at the time of deployment. The matrix parameters are automatically transformed to properties on the deployed artifact.

Dynamic Properties in Deployment

Depending on your deployment framework, you can use dynamic properties. For example, when using Maven, you can add the parameters buildNumber and revision to the deployment URL. At deployment time, Maven replaces the parameters with dynamic values from the project properties.

For example, given the following:

  • Distribution URL:

    http://myserver:8081/artifactory/qa-releases;buildNumber=${buildNumber};revision=${revision}
  • Deployment path to the qa-releases repository:

    /org/jfrog/build-info-api/1.3.1/build-info-api-1.3.1.jar
  • Final deployment URL:

    http://myserver:8081/artifactory/qa-releases;buildNumber=249;revision=1052/org/jfrog/build-info-api/1.3.1/build-info-api-1.3.1.jar

The final deployed item build-info-api-1.3.1.jar has two properties:

buildNumber=249
revision=1052
Matrix Parameters Queries for Artifact Resolution

You can use matrix parameters in artifact resolution to control how artifacts are found and served. Two types of queries are supported:

  • Non-conflicting values: Resolved artifacts may either have no matching property, or have a property that matches the specified key and value exactly. Non-conflicting values are not mandatory and are identified by a key=value parameter.

  • Mandatory values: Resolved artifacts must have a property that matches the specified key and value exactly. Mandatory properties are identified by a key+=value parameter, with the plus sign + denoting that the property is mandatory for artifact resolution.

The following table provides examples of artifact resolution results based on artifact properties and specified matrix parameters.

Query Type

Artifact Property

Matrix Parameter

Resolution Result

Non-conflicting values

color=black

color=black

OK (200)

None or height=50

color=black

OK (200)

color=red

color=black

NOT_FOUND (404)

Mandatory values

color=black

color+=black

OK (200)

None or height=50

color+=black

NOT_FOUND (404)

color=red

color+=black

NOT_FOUND (404)