Is there any way to exclude certain Maven artifacts when deploying to Artifactory with JFrog CLI?

Viewed 709

I'm trying to automate a Gitlab CI/CD pipeline for building and deploying a multi-module Maven project to Artifactory. I came across the JFrog CLI tool, but I have an issue due to the fact that there are some jars in my projects that have to be excluded from deployment.

The command I execute is something like this:

./jfrog rt mvn "clean install pom.xml" configuration.yml --build-name="something" --build-number="something"

In the documentation I cannot see any "--exclusions" parameter that I can configure.

How can I can configure an exclude pattern the same way I can with Jenkins Artifactory Plugin? Jenkins Artifactory plugin - exclude patterns

1 Answers

This feature is not yet officially supported in the JFrog CLI.

However, as a workaround, you can provide the artifactory.publish.excludePatterns Java property with a comma-separated list of excluded paths:

jfrog rt mvn clean install -Dartifactory.publish.excludePatterns="exclude-pattern-1,exclude-pattern-2"

# Example:
jfrog rt mvn clean install -Dartifactory.publish.excludePatterns="*artifact1*,*artifact2*"

You may expect to see the following prints in the logs:

[main] INFO org.jfrog.build.extractor.maven.BuildInfoRecorder - 'your-excluded-artifact-name' will not be deployed due to the defined include-exclude patterns.

Related