使用 Maven 部署到 Artifactory 时排除文件

Excluding files while deploying to Artifactory using Maven

我们正在使用 Maven 3.3.9 版本,并使用 Maven 部署到 v。我们在 pom.xml 和 运行 Maven 目标 "mvn clean deploy" 中添加了分发管理。到目前为止,一切正常,.pom、.jar、.xml 等所有文件都部署到 Artifactory。

现在,我们得到了一个场景,我们只想部署 jar 文件并在使用 Maven 部署时排除所有其他文件。

我已经尝试过使用

这里提到的http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploying-with-classifiers.html

mvn deploy -Dtypes=jar 但运气不好。

如何在使用 Maven 部署到 artifactory 时排除文件?

我正在使用 maven-artifactory-plugin 将 Maven 项目部署到 Artifactory。它有 <excludePatterns> 配置,允许抑制文件部署。以下配置将仅部署 .war 文件而不部署 .pom

<plugin>
        <groupId>org.jfrog.buildinfo</groupId>
        <artifactId>artifactory-maven-plugin</artifactId>
        <version>2.6.1</version>
        <executions>
          <execution>
            <id>build-info</id>
            <goals>
              <goal>publish</goal>
            </goals>
            <configuration>
              <publisher>
                <contextUrl>https://artifactory.your.company.com/artifactory</contextUrl>
                <username>${artifactory.user}</username>
                <excludePatterns>*.pom</excludePatterns>
                <password>${artifactory.key}</password>
                <repoKey>release-repo</repoKey>
                <snapshotRepoKey>snapshot-repo</snapshotRepoKey>
              </publisher>
            </configuration>
          </execution>
        </executions>
      </plugin>