You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Mina R Waheeb <sy...@gmail.com> on 2008/07/29 16:52:12 UTC

Maven & Repository Layout

Hi,
   I'm trying to setup SVN repository for huge amount of code managed
by Maven software project management. We have hierarchical multi-layer
directory layout, The tree below describe our structure.

|--- Project
    |---- pom.xml (Maven project descriptor)
    |---- component 1 (A leaf componet)
         |---- pom.xml
         |---- src
    |---- component 2 (A container component or sub-project)
         |---- pom.xml
         |---- comp2-sub1 (A container component or sub-project)
              |---- pom.xml
              |---- comp2-sub1-sub
                   |---- pom.xml
                   |---- src

We need to have a development line for each component. After reading
the SVN book and googling, I'm trying to apply the SVN recommended
layout trunk, tags and branches to our structure, I will apply it to
the folders contains source code or the leaf componenets so it will be
like below.

|--- Project
    |---- pom.xml (Maven project descriptor)
    |---- component 1 (A leaf componet)
         |---- branches/
         |---- tags/
         |---- trunk/
              |---- pom.xml
              |---- src
    |---- component 2 (A container component or sub-project)
         |---- pom.xml
         |---- comp2-sub1 (A container component or sub-project)
              |---- pom.xml
              |---- comp2-sub1-sub
                   |---- branches/
                   |---- tags/
                   |---- trunk/
                        |---- pom.xml
                        |---- src

But i still have some question i can't find answer for it:
  - In the non-leaf components each one of em, contains POM file which
contains a valuable information for the children projects and the
build system. This file in this structure has no branches or tags just
a general trunk line, What about the release process which require a
copy from this file be frozen?
  - How can i make a general checkout process to compile the code from
source. The checkout will fetch the trunks and tags which will make
the build process fails, Do i have to create a separated folder and
use svn:externals to make acceptable build structure as a special case
for this process?


There is another methodology to create a flat structure for all the
system components and use the idea of svn:externals to link em all as
described below.

|--- REPO
    |---- comp1.sub.component1
    |---- comp2.sub2.component1
         |---- branches/
         |---- tags/
         |---- trunk/
              |---- pom.xml
              |---- src
    |---- project ()
          |---- pom.xml (Maven project descriptor)
          |---- component 1 (external link to REPO/comp2.sub2.component1/trunk)

In this case the problem of the container componet POM file still exist :(

Is there any recommendation or best practices for the above structure
or Maven layout.

Thanks in advance

Regards,
Mina R Waheeb

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Maven & Repository Layout

Posted by Benjamin Smith-Mannschott <bs...@gmail.com>.
On Jul 29, 2008, at 18:52, Mina R Waheeb wrote:
>
> There is another methodology to create a flat structure for all the
> system components and use the idea of svn:externals to link em all as
> described below.
>
> |--- REPO
>    |---- comp1.sub.component1
>    |---- comp2.sub2.component1
>         |---- branches/
>         |---- tags/
>         |---- trunk/
>              |---- pom.xml
>              |---- src
>    |---- project ()
>          |---- pom.xml (Maven project descriptor)
>          |---- component 1 (external link to REPO/ 
> comp2.sub2.component1/trunk)

Go flat, if you can.

repo:
     project/
         trunk/
             pom.xml
         tags/
         branches/
     component1/
         trunk/
             pom.xml
             src
         tags/
         branches/
     component2/
         trunk/
             pom.xml
         tags/
         branches/
     component2.sub1/
         trunk/
             pom.xml
         tags/
         branches/
     component2.sub1.sub
         trunk/
             pom.xml
             src
         tags/
         branches/

In this way, each maven project becomes its own little repository.  I
find keeping the structure flat like this simplifies a number of
things.  It also works better than nested projects when used with a
combination of m2eclipse + subclipse.

The problem, of course, is that you'll want to be able to refer form
parent poms to their children since it looks like you're doing
multi-module builds.  You can use relative paths to your sub-modules:

component2.sub1/pom.xml :
   ...
   <modules>
    <module>../component2.sub1.sub
    ...
   </modules>
   ...

Now that means that you've got to get all your checkouts as siblings.
You could solve this by either scripting the checkout:

for p in project component1 component2 component2.sub1 \
          component2.sub1.sub
do
         svn co svn://repo/$p/trunk $p
done

Or, you could establish a special class of multi-module checkout
folders using svn externals.

repo:
     ...
     buildbranches/  +---------------+
         trunk <---  | svn:externals |
                  +----------------------------------------------------+
                  | project             svn://repo/project/trunk       |
                  | component1          svn://repo/component1/trunk    |
                  | ...                                                |
                  | component2.sub1.sub svn://repo/component2.sub1.sub |
                  +----------------------------------------------------+

When you pull a logical branch across multiple components, it will
result in one svn branch in for each of the components. (These
branches will just all have the same name.)  You could use a
buildbranch to pull these together to make it easier to check them out
together.

Anyway, those are my thoughts.  This is how I would do it.  In fact,
this is how I am doing it.  Though I hasten to add that I'm still a
relative beginner in trying to make maven + subclipse + m2eclipse play
nice at the office.

// Ben

  
             

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Maven & Repository Layout

Posted by Konstantin Kolinko <kn...@gmail.com>.
2008/7/30 Mina R Waheeb <sy...@gmail.com>:
>
> I can't make one big trunk for all the code, because the code is
> related but in the end its assembled in separated products.
>
> The layout below explains more our code structure.
>
> |--- Root
>    |---- pom.xml (Maven global organization descriptor)
>    |---- commons
>         |---- component 1 (A leaf componet)
>              |---- pom.xml
>              |---- src
>         |---- component 2 (A leaf componet)
>              |---- pom.xml
>              |---- src
>    |---- Project A (A container for project)
>         |---- pom.xml
>         |---- comp2-sub1 (A container component or sub-project)
>              |---- pom.xml
>              |---- c2-s1-s1 (dependency on commons/componet2)
>                   |---- pom.xml
>                   |---- src
>    |---- Project B (A container for project)
>         |---- pom.xml
>         |---- comp2-sub1 (A container component or sub-project)
>              |---- pom.xml
>              |---- comp2-sub1-sub (integration dependency on Project
> A/c2-s1-s1)
>                   |---- pom.xml
>                   |---- src
>
> The code is too big, I hope you get the hole picture now and thanks for reply.
>
> Regards,
> Mina R Waheeb
>

Regarding the repository layout and where the trunk, tags, branches
subdirectories are located, there are two common approaches:

/trunk
|-- /subprojects

and
/project1
|-- /trunk
project2
|-- /trunk

I personally prefer the first one and use
/tags/projectname/tagname
to create tags for single projects.

I have seen two development communities, that have recently (~1 year
ago or so) switched from the first layout to the second one and
vice versa, respectively.

The one is Dojo Toolkit, see
http://dojotoolkit.org/book/dojo-book-0-9/part-4-meta-dojo/using-subversion

Their old (aka 0.4.x-0.5.x) code is in /trunk, their recent code is a
collection of
/dojo/trunk
/dijit/trunk
/dojox/trunk
/util/trunk

They use svn:externals configured e.g. in /view/anon/all/trunk to check out
all 4 of them at once. Note the name: "view".

Interesting enough is the question where their tags and branches do go:
the names that follow the release numbers do go into /tags, /branches
at the root level.

Though there do exist some component-level branches, e.g.
/dojo/branches/openajax/

The other project is Apache Tomcat.
See
http://tomcat.apache.org/svn.html

They used to have separate components in separate subtrees.

Recently, when starting development of Tomcat 6.0, they decided
to move them all into a single source tree.

Note, that to checkout tomcat 6.0 source code (or the trunk, aka
future 6.2.x), you just have to go to  /tomcat/tc6.0.x or
/tomcat/trunk.

To checkout the 5.5 or 4.1 code, you go to
/tomcat/current/tc5.5.x
/tomcat/current/tc4.1.x
or to
/tomcat/current/svn15/tc5.5.x
/tomcat/current/svn15/tc4.1.x
if you are already using subversion 1.5 client (those views have
relative svn:externals paths that are understood by 1.5 clients).

Earlier tomcat versions have been moved to
/tomcat/archive

Tomcat 6.0 code is easier to checkout. It is easier to commit changes.
(You can commit changes across components only if those are in
single WC. If those are loaded with svn:externals, you cannot commit
them in a single commit). And it is easier to browse through the web
access.

In essence, it is up to you to decide, what path to follow.

You may also look at the commit histories of the projects, to
see what steps they require when performing a release.

Also, consider what code is required for your developers
to do their work. What parts of the repository they need
to checkout and commit to. What parts are covered by
a tag or branch, when you create them.

The above suggestions are not related with maven. I do not have
maven experience yet.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Maven & Repository Layout

Posted by Mina R Waheeb <sy...@gmail.com>.
Hi Karl,

On 7/29/08, Karl Heinz Marbaise <kh...@gmx.de> wrote:
> Hi,
>
>
> the question you have to answer is simply:
>
> Are those leaf components used by other parent projects except the one
> you described here?

Yes, the leaf components are dependency (runtime or compile time) for
another leaf or non-leaf components.

>
>> There is another methodology to create a flat structure for all the
>> system components and use the idea of svn:externals to link em all as
>> described below.
>>
>> |--- REPO
>>     |---- comp1.sub.component1
>>     |---- comp2.sub2.component1
>>          |---- branches/
>>          |---- tags/
>>          |---- trunk/
>>               |---- pom.xml
>>               |---- src
>>     |---- project ()
> You should simply create trunk, tags and branches folders for it, cause
> it's part of your release process so you have to make tags for releases
> and branches for different development lines...
>
> put the following onto the "trunk".
>>           |---- pom.xml (Maven project descriptor)
>>           |---- component 1 (external link to
>> REPO/comp2.sub2.component1/trunk)

Yeah, I understand your point.

>>
>> In this case the problem of the container componet POM file still exist :(
>>
>> Is there any recommendation or best practices for the above structure
>> or Maven layout.
>
> The other things is never use an external with "/trunk". You should use
> "/tags/XXX" instead....

What about checkout current development line for the hole project?

>
> I would suggest to use a simpler layout...
> |---Root
> |    !
> |    +--- Project
> |           +-- tags
> |           +-- branches
> |           +-- trunk
> |                 +--- pom.xml
> |                 +--- component1
> |                        +--- pom.xml
> |                 +--- component2
> |                        +--- pom.xml
> ....will be much more simpler to use....

I can't make one big trunk for all the code, because the code is
related but in the end its assembled in separated products.

The layout below explains more our code structure.

|--- Root
    |---- pom.xml (Maven global organization descriptor)
    |---- commons
         |---- component 1 (A leaf componet)
              |---- pom.xml
              |---- src
         |---- component 2 (A leaf componet)
              |---- pom.xml
              |---- src
    |---- Project A (A container for project)
         |---- pom.xml
         |---- comp2-sub1 (A container component or sub-project)
              |---- pom.xml
              |---- c2-s1-s1 (dependency on commons/componet2)
                   |---- pom.xml
                   |---- src
    |---- Project B (A container for project)
         |---- pom.xml
         |---- comp2-sub1 (A container component or sub-project)
              |---- pom.xml
              |---- comp2-sub1-sub (integration dependency on Project
A/c2-s1-s1)
                   |---- pom.xml
                   |---- src

The code is too big, I hope you get the hole picture now and thanks for reply.

Regards,
Mina R Waheeb

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Maven & Repository Layout

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,


the question you have to answer is simply:

Are those leaf components used by other parent projects except the one
you described here?

> There is another methodology to create a flat structure for all the
> system components and use the idea of svn:externals to link em all as
> described below.
> 
> |--- REPO
>     |---- comp1.sub.component1
>     |---- comp2.sub2.component1
>          |---- branches/
>          |---- tags/
>          |---- trunk/
>               |---- pom.xml
>               |---- src
>     |---- project ()
You should simply create trunk, tags and branches folders for it, cause
it's part of your release process so you have to make tags for releases
and branches for different development lines...

put the following onto the "trunk".
>           |---- pom.xml (Maven project descriptor)
>           |---- component 1 (external link to REPO/comp2.sub2.component1/trunk)
> 
> In this case the problem of the container componet POM file still exist :(
> 
> Is there any recommendation or best practices for the above structure
> or Maven layout.

The other things is never use an external with "/trunk". You should use
"/tags/XXX" instead....

I would suggest to use a simpler layout...
|---Root
|    !
|    +--- Project
|           +-- tags
|           +-- branches
|           +-- trunk
|                 +--- pom.xml
|                 +--- component1
|                        +--- pom.xml
|                 +--- component2
|                        +--- pom.xml
....will be much more simpler to use....

Kind regards
Karl Heinz Marbaise
-- 
SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
Hauptstrasse 177                         USt.IdNr: DE191347579
52146 Würselen                           http://www.soebes.de

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org