With the maven-release-plugin, how to branch a module and its children?

送分小仙女□ 提交于 2019-12-11 05:00:03

问题


Say you have a module named "parent" which has 2 childs "childA" and "ChildB"

If I run

mvn release:branch -DbranchName=my-branch

in the "parent" folder, it will branch the parent module code to SVN /branches/my-branch WITHOUT the 2 child modules.

I would like release:branch to branch the parent module and all its children to

  • /branches/my-branch/parent
  • /branches/my-branch/childA
  • /branches/my-branch/childB

I didn't found any solution in the doc yet:

  • http://maven.apache.org/plugins/maven-release-plugin/branch-mojo.html
  • http://maven.apache.org/plugins/maven-release-plugin/examples/branch.html

Is it feasible ?

Any help would be appreciated, thanks

Fred


回答1:


I found the solution.

if the modules are structured hierarchically it works:

/trunk/parent /trunk/parent/childA /trunk/parent/childB

but you must ensure that SCM parameters are 100% correct.

i.e.:

/trunk/parent/pom.xml

<scm>
    <connection>scm:svn:https://svnserver:18080/svn/trunk</connection>
    <developerConnection>scm:svn:https://svnserver:18080/svn/trunk</developerConnection>
    <url>https://svnserver:18080/viewvc/trunk</url>
</scm>

/trunk/parent/childA/pom.xml

<scm>
    <connection>scm:svn:https://svnserver:18080/svn/trunk/childA</connection>
    <developerConnection>scm:svn:https://svnserver:18080/svn/trunk/childA</developerConnection>
    <url>https://svnserver:18080/viewvc/trunk/childA</url>
</scm>

/trunk/parent/childB/pom.xml

<scm>
    <connection>scm:svn:https://svnserver:18080/svn/trunk/childB</connection>
    <developerConnection>scm:svn:https://svnserver:18080/svn/trunk/childB</developerConnection>
    <url>https://svnserver:18080/viewvc/trunk/childB</url>
</scm>

Then when you run the following command: mvn release:branch -DbranchName= -DupdateBranchVersions=true -DupdateWorkingCopyVersions=true -DreleaseVersion= -DdevelopmentVersion=

All modules are correctly branched to /branches/ with all versions and SCM properties automatically updated



来源:https://stackoverflow.com/questions/6336340/with-the-maven-release-plugin-how-to-branch-a-module-and-its-children

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!