使用 maven scm 插件提交多个文件

Commit multiple files with maven scm plugin

我想 git 使用 maven scm 插件 (v1.9.4) 在不同的文件夹中提交两个文件。例如:abc/p.jsonxyz\p.json。我不想提交任何其他文件,例如 other/p.json

根据 documentationchekin 目标,逗号分隔列表(例如 abc/p.json,xyz/p.json 应该有效。但它最终会提交所有文件。

我在 Maven 发布插件的 <preparationGoals> 配置中使用 scm:checkin 目标。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>${maven.release.plugin.version}</version>
    <configuration>
        <preparationGoals>
            clean verify
            scm:checkin -DpushChanges=false -Dmessage="[maven-release-plugin] Update version text"
            -Dincludes="abc/p.json,xyz/p.json"
    </configuration>
</plugin>

如何只提交 abc/p.jsonxyz/p.json 文件?

我能够通过创建配置文件获得签入的文件列表,类似于:

<profile>
  <id>commit-changed-files</id>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-scm-plugin</artifactId>
          <configuration>
            <includes>file1,file2,file3,file4</includes>
            <message>[maven-release-plugin] commit changed files</message>
            <pushChanges>false</pushChanges><!-- because I use git -->
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</profile>

然后,在发布插件配置中:

        <preparationGoals>-Pcommit-changed-files clean scm:add scm:checkin</preparationGoals>
        <completionGoals>-Pcommit-changed-files clean scm:add scm:checkin</completionGoals>

参考:formatter-m2e-configurator's pom.xml