【问题标题】:Commit some files while maven release:prepare在 maven 发布时提交一些文件:prepare
【发布时间】:2012-05-21 22:38:41
【问题描述】:

是否可以在 mvn release:prepare 时提交一些文件(没有 pom.xml)?

在我的 MultiModul 项目中,我使用 prepareGoals 配置了发布插件,以更改 sql 文件中的版本。

<preparationGoals>clean verify org.codehaus.mojo:build-helper-maven-plugin:1.5:parse-version com.google.code.maven-replacer-plugin:replacer:1.5.0:replace</preparationGoals>

一切正常,但更改后的 sql 文件不会被提交。

sql 文件位于父文件夹的子目录中。没有pom.xml

【问题讨论】:

标签: maven release commit prepare


【解决方案1】:

我现在在准备目标中使用 scm:checkin

clean 验证 org.codehaus.mojo:build-helper-maven-plugin:1.5:parse-version com.google.code.maven-replacer-plugin:replacer:1.5.0:replace scm:checkin -Dmessage=" ...” -DworkingDirectory=./.../...

但这与 pom.xml 的提交内容不同。 这导致 mvn rellease:rollback 不会回滚准备目标中的第一次提交!

现在看起来像这样:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <tagBase>
                    ......
                </tagBase>
                <autoVersionSubmodules>true</autoVersionSubmodules>
                <arguments>-Dtest='*IT,*Test' -DfailIfNoTests=false</arguments>
                <tagNameFormat>@{project.version}</tagNameFormat>
                <preparationGoals>clean verify org.codehaus.mojo:build-helper-maven-plugin:parse-version com.google.code.maven-replacer-plugin:replacer:replace scm:checkin -Dmessage="Version in Komponentenversion.sql incrementiert" -DworkingDirectory=./db/include</preparationGoals>
            </configuration>
        </plugin>

【讨论】:

  • 根据用例,您可能希望在准备步骤的完成期间提交文件。为此,请使用 &lt;completionGoals&gt; 而不是 &lt;preparationGoals&gt;。另请参阅documentation
【解决方案2】:

【讨论】:

  • 发布前已经添加了sql文件。并在发布后修改但未提交。
  • clean verify org.codehaus.mojo:build-helper-maven-plugin:1.5:parse-version com.google.code.maven-replacer-plugin:replacer:1.5.0:替换 scm:checkin -Dmessage="..." -DworkingDirectory=./.../...
猜你喜欢
  • 1970-01-01
  • 2016-12-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-18
  • 2013-04-13
  • 1970-01-01
  • 2015-11-16
相关资源
最近更新 更多