使用 JFrog CLI 部署到 Artifactory 时,有什么方法可以排除某些 Maven 工件吗?

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

我正在尝试自动化 Gitlab CI/CD 管道,用于构建多模块 Maven 项目并将其部署到 Artifactory。我遇到了 JFrog CLI 工具,但我遇到了一个问题,因为我的项目中有一些 jar 必须从部署中排除。

我执行的命令是这样的:

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

在文档中我看不到任何可以配置的“--exclusions”参数。

我如何才能像使用 Jenkins Artifactory 插件一样配置排除模式? Jenkins Artifactory plugin - exclude patterns

JFrog CLI 尚未正式支持此功能。

但是,作为解决方法,您可以为 artifactory.publish.excludePatterns Java 属性 提供一个以逗号分隔的排除路径列表:

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*"

您可能希望在日志中看到以下输出:

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