|
Normally, all SCM tools tag recursively but it won't work in some case.
With subversion (it can be the same for cvs and others), some users use a flat layout on their own machine but not in the SCM. for exemple with svn: in svn: ROOT/
module1/
branches/
tags/
trunk/
pom.xml
module2/
branches/
tags/
trunk/
pom.xml
and in working copy: ROOT/
module1/
pom.xml
module2/
pom.xml
With this structure, some users will want a global tag under ROOT/tags/ and some others will want one tag by module under /ROOT/moduleX/tags/ So, how would one solve that with the current way that the scm:tag works??
Basically in the case you outlined, one needs to issue 2 mvn scm:tag commands, if neither pom is a superpom of the other. In that case, my algorithm would still work. What is your opinion on how to solve this issue? Basically the main usage (for me that is) of the scm:tag command is to automatically tag a complete project using a single command in a nightly build process (e.g. CruiseControl, Continuum) using the build number as tag. And the single command should work for both a 'normal' maven layout as well as a flat project layout. if relative path defined in module exists in SCM, your algorithm should work.
About nightly builds, I think it should be the job of the CI tool to create a tag if the build is ok. This feature will be implemented in a future Continuum version I've attached a patch.
The patch provides support for tagging a flat project layout. I've disabled the @aggregator Maven option to process multiple modules. Furthermore. it basically keeps track of all the ScmFileSet basedirectories which have been processed in a static HashSet. Before a new fileset is tagged, it checks that the ScmFileSet has not already been processed. Next it checks that the current ScmFileSet is not a sub-directory of an already processed basedir. If that's all true, the fileset is tagged and its basedir is added to the static HashSet.. This solution works in both a standard Maven2 layout (i.e. not tagging sub-projects twice because it keeps track of already processed basedirs) and a flat layout (i.e. because the @aggregator option is disabled). I am not comfortable to remove the @aggregator.
Vincent, why are you not comfortable to remove the @aggregator? The current tagging functionality basically doesn't work with any flat project layout. The patch supplied has been in production at our company for over a year without any issues. I would really like to see this issue closed one way or the other, it has been open for over a year now.
OK, I did some testing today using my patch on a Subversion repo ...... and it fails. The problem seems to be that when I specify a connection URL like "scm:svn:svn://localhost/testrepo/trunk/MavenRoot" for the Super Pom project (see the example in my original post), the directory in which the files are put are "/testrepo/tags/{myTag}" and NOT "/testrepo/tags/{myTag}/MavenRoot". I had expected that the SCM plugin would generate the latter structure, but it doesn't.
This results in a situation in which the tagging of the second project fails. Its connection URL is "scm:svn:svn//localhost/testrepo/trunk/Module1", and when the tag goal executes (with the patched plugin) it wants to create this structure "/testrepo/tags/{myTag}", which has already been created by the MavenRoot project, so the tagging fails. Why does the plugin not preserve the original folder structure when tagging a project? There seems to be some other issues open on the SCM Subversion which basically have to do with the same problem, the plugin not being able to support a flat project stucture. |
|||||||||||||||||||||||||||||||||||||||||||||||||
So my question is if all SCM tools tag recursively (e.g. like CVS, tag the basedir all files in the directory tree which are under CVS control get tagged)?
The algorithm I have in mind works like this.
Using this algorithm, the aggregator tag can be removed. If all SCM tools work like this, this algorithm will ensure correct tagging behaviour for boh standard - and flat project layouts.