簡體   English   中英

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

[英]Commit multiple files with maven scm plugin

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

根據chekin目標的文檔,逗號分隔的列表(例如abc/p.json,xyz/p.json應該可以工作。 但它最終提交了所有文件。

我將scm:checkin目標與 maven 發布插件的<preparationGoals>配置一起使用。

<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 的 pom.xml

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM