首页 文章

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

提问于
浏览
0

我们正在使用Maven 3.3.9版本,并使用Maven部署到v . 我们在pom.xml中添加了分发管理并运行Maven目标“mvn clean deploy” . 直到现在一切正常,所有文件如.pom,.jar,.xml等都部署到Artifactory .

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

我试过这里提到http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploying-with-classifiers.html使用

mvn deploy -Dtypes=jar 但没有运气 .

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

1 回答

  • 2

    我正在使用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>
    

相关问题