使用 maven scm 插件提交多个文件 [英] Commit multiple files with maven scm plugin

查看:50
本文介绍了使用 maven scm 插件提交多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

根据chekin 目标的文档,一个逗号分隔的列表,例如 abc/p.json,xyz/p.json 应该可以工作.但它最终提交了所有文件.

我将 scm:checkin 目标与 maven 发布插件的

配置一起使用.

<groupId>org.apache.maven.plugins</groupId><artifactId>maven-release-plugin</artifactId><version>${maven.release.plugin.version}</version><配置><准备目标>清洁验证scm:checkin -DpushChanges=false -Dmessage="[maven-release-plugin] 更新版本文本"-Dincludes="abc/p.json,xyz/p.json"</配置></插件>

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

解决方案

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

<id>commit-changed-files</id><构建><插件管理><插件><插件><groupId>org.apache.maven.plugins</groupId><artifactId>maven-scm-plugin</artifactId><配置><includes>file1,file2,file3,file4</includes><message>[maven-release-plugin] 提交更改的文件</message><pushChanges>false</pushChanges><!-- 因为我使用 git --></配置></插件></plugins></pluginManagement></build></个人资料>

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

 

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

参考:formatter-m2e-configurator的pom.xml

I want to git commit two files in different folders with maven scm plugin (v1.9.4). Eg: abc/p.json and xyz\p.json. I dont want to commit any other files such as other/p.json

According to the documentation for the chekin goal, a comma separated list such as abc/p.json,xyz/p.json should work. But it ends up commiting all the files.

I am using the scm:checkin goal with the maven release plugin's <preparationGoals> configuration.

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

How do I commit just the abc/p.json and xyz/p.json files?

解决方案

I was able to get a list of files checked in by creating a profile, similar to:

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

And then, in the release plugin configuration:

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

Reference: formatter-m2e-configurator's pom.xml

这篇关于使用 maven scm 插件提交多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆