You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Kaiser, Hans" <r_...@gmx.de> on 2006/08/13 23:41:52 UTC

Projectstructure

Hello list,

I am currently astonished, how maven handles many build problems. It is
pretty fine!
Anyway I have troubles to integrate it into my project structure.

I am using eclipse and I have my eclipse sub-projects all together in a
CVS-module my-app.
Here the CVS structure:
my-app (CVS-module)
   presentation
   common
   web

In eclipse I have following projects:
presentation
common
web


Now I am wondering, how could I add a pom.xml to the given structure?
Does the CVS-module my-app has to be checkout into ecplise-workspace, so
the resulting projects in eclipse will be:
my-app
presentation
common
web

What will be the best way to use such project structure in maven?

best regards

Re: Projectstructure

Posted by Kai Uwe Bachmann <ka...@arcor.de>.
Hello,

in my opinion you don't have a problem with maven but with Eclipse. 
Have you tried to post your problem to an Eclipse forum ?

Mit freundlichen Grüßen / Best Regards

Kai Uwe Bachmann
Am 15.08.2006 um 20:01 schrieb Kaiser, Hans:

> Hello,
>
>> it's not required to put the subprojects in the directory of the root
>> project. You can place them all in separate directories
>> like Eclipse does and reference to it by relative path. I think you
>> have a directory structure like
>> wokspace
>> |-- myApp
>> |-- common
>> ...
>> so you have to create a pom.xml in myApp with
>> ...
>> <modules>
>>    <module>../common</module>
>>     ...
>> </modules>
>> ...
>
> no project structure is
>
> workspace
> |-- my-app (is also the CVS-module)
>      |-- presentation
>      |-- common
>      |-- web
>      |-- pom.xml (the master pom)
>
>
>> I think this will solve your problem.
>>
>> If common, presentation and web are independent of myApp it could be a
>> better solution to reference them as dependency
>> and let maven do the rest
>
>
> I will try the relative paths by adding the master pom to a subdir.
> Anyway, would be a possibility to setup an environment for eclipse, 
> with
> the given structure?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Projectstructure

Posted by Max Cooper <ma...@maxcooper.com>.
Kaiser, Hans wrote:
> 
> workspace
> |-- my-app (is also the CVS-module)
>      |-- presentation
>      |-- common
>      |-- web
>      |-- pom.xml (the master pom)

Eclipse does not support nested projects, so that structure won't work 
(or at least won't work well in an Eclipse-friendly way). It is best to 
have a separate Eclipse project for each module. And by "best", I mean 
it is the only sane choice, even though this Eclipse limitation drives 
me mad. :-)

To be able to edit the top-level pom.xml, you must move it into another 
"peer module". Let's call it "master". You will need to adjust the paths 
to the modules in the master pom. "presentation" will change to 
"../presentation", etc.

my-app
   |-- presentation
   |-- common
   |-- web
   |-- master (the master pom.xml is in this directory)

Then setup an Eclipse workspace, and checkout the presentation, common, 
web, and master modules as Eclipse projects. Done.

Personally, I prefer to checkout the project from the root (my-app) 
outside of Eclipse, and create an Eclipse workspace that DOES NOT 
overlap my project working directories. Then I create a new Eclipse 
project for each module by pointing Eclipse to the existing directories 
in the my-app working directory tree. I use a bunch of different tools 
when working on projects, so I don't want the working files to be 
"owned" by Eclipse (and stashed away in a workspace somewhere). This 
arrangement also allows you to commit changes to more than one module in 
the same transaction, though you have to use something other than 
Eclipse to do the commit. And you could even keep the pom.xml file at 
the top level and avoid creating the master directory -- however, in 
doing so you lose the ability to edit the pom.xml in Eclipse, so I still 
use the "master" directory technique anyway.

-Max

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Projectstructure

Posted by "Kaiser, Hans" <r_...@gmx.de>.
Hello,

> it's not required to put the subprojects in the directory of the root 
> project. You can place them all in separate directories
> like Eclipse does and reference to it by relative path. I think you 
> have a directory structure like
> wokspace
> |-- myApp
> |-- common
> ...
> so you have to create a pom.xml in myApp with
> ...
> <modules>
>    <module>../common</module>
>     ...
> </modules>
> ...

no project structure is

workspace
|-- my-app (is also the CVS-module)
     |-- presentation
     |-- common
     |-- web
     |-- pom.xml (the master pom)


> I think this will solve your problem.
> 
> If common, presentation and web are independent of myApp it could be a 
> better solution to reference them as dependency
> and let maven do the rest


I will try the relative paths by adding the master pom to a subdir.
Anyway, would be a possibility to setup an environment for eclipse, with
the given structure?

Re: Projectstructure

Posted by Kai Uwe Bachmann <ka...@arcor.de>.
Hello,

it's not required to put the subprojects in the directory of the root 
project. You can place them all in separate directories
like Eclipse does and reference to it by relative path. I think you 
have a directory structure like
wokspace
|-- myApp
|-- common
...
so you have to create a pom.xml in myApp with
...
<modules>
   <module>../common</module>
    ...
</modules>
...

I think this will solve your problem.

If common, presentation and web are independent of myApp it could be a 
better solution to reference them as dependency
and let maven do the rest

Mit freundlichen Grüßen / Best Regards

Kai Uwe Bachmann
Am 15.08.2006 um 13:56 schrieb Kaiser, Hans:

> Hello Kai Uwe,
>
>
>> my suggestion is a direcory structure of
>> myApp
>> |-- common
>> |-- presentation
>> |-- web
>> In CVS only the module myApp was checked in.
>> The whole project doesn't exists in the Eclipse workspace,
>
>
>
>> In Eclipse I've created a new workspace and 3 new projects from the
>> existing sources. The myApp
>> contains no sources itself and (only the pom file) so I doesn't create
>> an Eclipse project for it.
>> Finally I had only one CVS module with all the sources and no
>> duplications.
>
> ahh okay, hadn't known something about this option.
> To be sure, if we are takling about the same things, I have done
> following:
> - checked out my-app into the workspace
> - added common, presentation and web into eclipse as Projects (with
> existing project into workspace)
>
> Now I have no idea how to add the master POM.xml into my workspace.
> Could you give me an hint?
>
>
>> The only redundancies I have in my project are the dependencies 
>> between
>> the projects. This must be defined
>> in the maven pom and the Eclipse project because of a bug or missing
>> feature in the Eclipse plugin. I hope this
>> lack will be fixed in the next version.
>>
>> BTW: The maven integration of Netbeans is much better if it could be 
>> an
>> alternative for you.
>
> I thought about it, but we are using eclipse
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Projectstructure

Posted by "Kaiser, Hans" <r_...@gmx.de>.
Hello Kai Uwe,


> my suggestion is a direcory structure of
> myApp
> |-- common
> |-- presentation
> |-- web
> In CVS only the module myApp was checked in.
> The whole project doesn't exists in the Eclipse workspace,



> In Eclipse I've created a new workspace and 3 new projects from the 
> existing sources. The myApp
> contains no sources itself and (only the pom file) so I doesn't create 
> an Eclipse project for it.
> Finally I had only one CVS module with all the sources and no 
> duplications.

ahh okay, hadn't known something about this option.
To be sure, if we are takling about the same things, I have done
following:
- checked out my-app into the workspace
- added common, presentation and web into eclipse as Projects (with
existing project into workspace)

Now I have no idea how to add the master POM.xml into my workspace.
Could you give me an hint?


> The only redundancies I have in my project are the dependencies between 
> the projects. This must be defined
> in the maven pom and the Eclipse project because of a bug or missing 
> feature in the Eclipse plugin. I hope this
> lack will be fixed in the next version.
> 
> BTW: The maven integration of Netbeans is much better if it could be an 
> alternative for you.

I thought about it, but we are using eclipse



Re: Projectstructure

Posted by Kai Uwe Bachmann <ka...@arcor.de>.
Hello,

my suggestion is a direcory structure of
myApp
|-- common
|-- presentation
|-- web
In CVS only the module myApp was checked in.
The whole project doesn't exists in the Eclipse workspace,

In Eclipse I've created a new workspace and 3 new projects from the 
existing sources. The myApp
contains no sources itself and (only the pom file) so I doesn't create 
an Eclipse project for it.
Finally I had only one CVS module with all the sources and no 
duplications.
The only redundancies I have in my project are the dependencies between 
the projects. This must be defined
in the maven pom and the Eclipse project because of a bug or missing 
feature in the Eclipse plugin. I hope this
lack will be fixed in the next version.

Mit freundlichen Grüßen / Best Regards

Kai Uwe Bachmann

BTW: The maven integration of Netbeans is much better if it could be an 
alternative for you.

Am 14.08.2006 um 09:57 schrieb Kaiser, Hans:

> Hello Kai Uwe,
>
> Thank you for your advice!
>
>
>> I have a similar project structure and I realized it as a Maven
>> multiproject (see HowTos).
>> Finaly you wil have 4 pom-files. One in the projects and one in the
>> module.
>
> fine, this was also my plan, but see project structure
>
>> In Eclipse I opened these projects simply by creating new projects 
>> from
>> existing source, so the module wasn't in the Eclipse workspace.
>
> I haven't got it, could you explain me, how you get it working with the
> "master-POM" which includes all my modules?
> As I can see, I will have to checkout following structure in eclipse:
> - presentation
> - common
> - web
> - the whole CVS-module my-app, which itself includes: (pom.xml,
> presentation, common, web)
>
> If so, this would be very odd, because of redundant data in the eclipse
> workspace.
> Could you explain me your approach?
>
> regards


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Projectstructure

Posted by "Kaiser, Hans" <r_...@gmx.de>.
Hello Kai Uwe,

Thank you for your advice!


> I have a similar project structure and I realized it as a Maven 
> multiproject (see HowTos).
> Finaly you wil have 4 pom-files. One in the projects and one in the 
> module.

fine, this was also my plan, but see project structure

> In Eclipse I opened these projects simply by creating new projects from 
> existing source, so the module wasn't in the Eclipse workspace.

I haven't got it, could you explain me, how you get it working with the
"master-POM" which includes all my modules?
As I can see, I will have to checkout following structure in eclipse:
- presentation
- common
- web
- the whole CVS-module my-app, which itself includes: (pom.xml,
presentation, common, web)

If so, this would be very odd, because of redundant data in the eclipse
workspace.
Could you explain me your approach?

regards

Re: Projectstructure

Posted by Kai Uwe Bachmann <ka...@arcor.de>.
Hello,

I have a similar project structure and I realized it as a Maven 
multiproject (see HowTos).
Finaly you wil have 4 pom-files. One in the projects and one in the 
module.

In Eclipse I opened these projects simply by creating new projects from 
existing source, so the module wasn't in the Eclipse workspace.

Mit freundlichen Grüßen / Best Regards

Kai Uwe Bachmann
Am 13.08.2006 um 23:41 schrieb Kaiser, Hans:

> Hello list,
>
> I am currently astonished, how maven handles many build problems. It is
> pretty fine!
> Anyway I have troubles to integrate it into my project structure.
>
> I am using eclipse and I have my eclipse sub-projects all together in a
> CVS-module my-app.
> Here the CVS structure:
> my-app (CVS-module)
>    presentation
>    common
>    web
>
> In eclipse I have following projects:
> presentation
> common
> web
>
>
> Now I am wondering, how could I add a pom.xml to the given structure?
> Does the CVS-module my-app has to be checkout into ecplise-workspace, 
> so
> the resulting projects in eclipse will be:
> my-app
> presentation
> common
> web
>
> What will be the best way to use such project structure in maven?
>
> best regards


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org