Baderous
Baderous

Reputation: 1069

Commit multi-module maven project to SVN

I used Maven to create several projects in Eclipse, based on Maven archetypes, and ended up with this project structure (a parent project with multiple modules):

<name>backoffice-root</name>    
<modules>
    <module>backoffice-web</module>
    <module>backoffice-ejb-core</module>
    <module>backoffice-ws</module>
    <module>backoffice-ear</module>
</modules>

Now I want to commit them to a SVN repository using Subclipse.

In my first approach, I added these projects to SVN in a flat hierarchy. The first project that I added was root, otherwise I'd get a warning saying that .svn folders in modules would be deleted:

backoffice-root    
backoffice-web
backoffice-ejb-core
backoffice-ws
backoffice-ear

If I try to commit after that I get an error "backoffice-root/backoffice-web is already under version control". I believe this happens because when I added the projects to SVN, a .svn folder was created inside each one of them, but I don't know how can I solve this problem without deleting these folders and losing the information contained within them.

So I tried a second approach: adding root to SVN and then all the others under root (mapping my Maven project structure to SVN repository), creating this structure in the repository:

backoffice-root    
    backoffice-web
    backoffice-ejb-core
    backoffice-ws
    backoffice-ear

But when I try to commit all of them, I get the same error of approach #1.

The only way that I get things to work is by just adding root to SVN and committing it (it commits all the modules since they are folders inside root). But I want to work on each project and commit them individually. Do I need to structure my Maven projects in a flat layout like explained in this post? How does one work this way with my original layout?

Upvotes: 2

Views: 2570

Answers (1)

Skizzo
Skizzo

Reputation: 2983

I'm working with the same your layout and everythings work. My project's skeleton is the following:

parent
  -model
  -util
  -services
  -web

model,util,services and web are all modules to parent and are placed in parent directory. Then I committed the parent project (that contains all modules) and finally I checked out and importing (In eclipse File->Import->Maven->Existing Maven Project) all modules.

Update1

Try to describe the procedure along some screenshoot:

Step1 I already committed the parent and all modules

enter image description here

After checkout you will wind the following situation:

enter image description here

where only the parent is linked with the svn. Now you have to do (File->Import->Maven->Existing Maven Project and selected all modules. Then automatically you will have all modules linked at the svn

enter image description here

Update2

My parent definition is the following:

<modules>
    <module>model</module>
    <module>util</module>
    <module>services</module>
    <module>vaadin-webapp</module>
</modules>

and each module has instead this configuration

<parent>
    <groupId>myCompany</groupId>
    <artifactId>myProject</artifactId>
    <version>2.2.1-SNAPSHOT</version>
</parent>

Upvotes: 4

Related Questions