本文介绍了在发布Maven时提交一些文件:准备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Is it possible to commit some file (no pom.xml) while mvn release:prepare?

在我的MultiModul项目中,我为rlease插件配置了prepareGoals来更改sql文件中的版本.

In My MultiModul Project I configured the rlease plugin with preparationGoals to change the Version in a sql file.

<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文件.

Everything works fine but the changed sql File will not be commited.

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

The sql File is in a subdirectory of the parent Folder. There are no pom.xml

推荐答案

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

I use now a scm:checkin in the preparationGoals

干净验证org.codehaus.mojo:build-helper-maven-plugin:1.5:parse-version com.google.code.maven-replacer-plugin:replacer:1.5.0:rep​​lace scm:checkin -Dmessage ="..."-DworkingDirectory =./.../...

clean verify 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 rlelease:rollback不会回退准备目标中的第一次提交!

But that is not the same Commit as what the pom.xml 's commited.This leads to that a mvn rlelease:rollback don't roll back the first commit in preparation goals!

现在看起来像这样:

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

这篇关于在发布Maven时提交一些文件:准备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 14:53