You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Kumar, Vaidhyanatha K." <va...@eds.com> on 2003/07/15 23:06:34 UTC

Eclipse & Maven project directory structure dilemma

The existing project looks like this
ProjectA  -- project_a.war
    mod1 --mod1.jar
        src/java
        web
    mod2 -- mod2.jar
        src/java
        web
    mod3
    .......
..........
 
 
To use maven & eclipse,
    Should be creating project & subprojects and convert them to eclipse project ??  Since mod1, mod2 etc are identical in the directory structure , I think it is a overkill to create various subprojects. The source code mod1, mod2 etc are in Clearcase.
How do I move forward?
Thanks for your help.
Vaidhy
    
    

Re: Eclipse & Maven project directory structure dilemma

Posted by "Mark H. Wilkinson" <mh...@kremvax.net>.
On Wed, 2003-07-16 at 07:51, Rafal Krzewski wrote:
> Kumar, Vaidhyanatha K. wrote:
> > The existing project looks like this
> > ProjectA  -- project_a.war
> >     mod1 --mod1.jar
> >         src/java
> >         web
> >     mod2 -- mod2.jar
> >         src/java
> >         web
> >     mod3
> >     .......
> > ..........
> 
> > To use maven & eclipse, Should be creating project & subprojects and
> > convert them to eclipse project ??

Yes, you should be creating one project per artifact. These will be
projects in both the Eclipse and Maven senses of the word.

>   Since mod1, mod2 etc are
> > identical in the directory structure , I think it is a overkill to
> > create various subprojects.

Given that mod1, mod2, mod3 and so on are functionally separate modules
of your system, lumping them all into one source tree to remove
duplication of the directory structure seems like a strange form of
economy. One of the main advantages of using maven is that it provides a
standardised build process that works for a source tree in a given
layout. Hence, maven projects are actually relatively lightweight things
- they don't (typically) require the maintenance effort associated with
an ant build for example. So, don't worry about creating multiple
projects if they have a correspondence with the modules that make up
your application.

Also, you might find it useful to stop thinking in terms of projects
living in a hierarchy (and thinking of some things as projects and other
things as subprojects). Each module should be a separate project
producing a named (and versioned) artifact. You might then have some
projects that assemble a group of artifacts to create something that you
can deploy (for example, a complete web application), but it's limiting
to believe that these dependencies will always be a strict hierarchy.

>  The source code mod1, mod2 etc are in
> > Clearcase. How do I move forward? Thanks for your help.

Given the directory layout you describe above, you shouldn't have too
much work to do to get the individual Java modules to build separately.
I'd then work out how to build the web application (using the war
plugin). You can open each of these projects in Eclipse and use it to do
your development, using maven periodically to make sure that you're
keeping the dependency information in each project.xml up to date. I
wouldn't bother with the reactor until you're wanting to automate the
whole build process, whether for releases or for a nightly build or
something.

Make sure project.xml is in clearcase, and that .project and .classpath
aren't in clearcase - you want to generate those from project.xml as a
way of verifying that project.xml is kept up-to-date.

> The Eclipse way is to set up each module as a separate project,
> declare dependencies between them using Eclipse UI. This lets you
> use Eclipse for daily edit-copile cycle. The downside of this approach
> that you need fairly complicated custom Maven configuration for
> assembling your application and for generating reports on the
> whole codebase.

I don't see where the complexity lies: it's not difficult to create a
maven project that builds a war archive from a few JSPs and dependency
jar files out of the repository. See
http://wiki.codehaus.org/maven/CreatingWebApplications

I'll admit that if you split your system into multiple projects, the
reports that maven generates become fragmented. Whether this is a
problem or not comes down to how well decoupled your modules are, I
think.

> The Maven way is to set up a single elicpse project with subdirectories
> for each module and use simple and standard reactored build.

Hmm; I'd disagree with that, in as much as there's nothing in maven that
supports the mapping of multiple maven projects to one eclipse project
that you describe. Quite the reverse, in fact. If you type 'maven
eclipse' in a project directory, maven will generate .project and
.classpath files suitable for importing the project into Eclipse. So I'd
say that maven tends to encourage a maven project and an eclipse project
to be equivalent.

You can also specify inter-project dependencies to carry across into the
Eclipse projects. For example, if I have the plexus source tree open as
a project in Eclipse, and I include the following in own projects'
project.xml:

    <dependency>
      <groupId>plexus</groupId>
      <artifactId>plexus</artifactId>
      <version>0.6</version>
      <url>http://plexus.codehaus.org/</url>
      <properties>
        <eclipse.dependency>true</eclipse.dependency>
      </properties>
    </dependency>

then 'maven eclipse' will generate an Eclipse project that has a
dependency on the 'plexus' eclipse project (rather than the jar file in
the repository).

-Mark.


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


Re: Eclipse & Maven project directory structure dilemma

Posted by Rafal Krzewski <Ra...@caltha.pl>.
Kumar, Vaidhyanatha K. wrote:
> The existing project looks like this
> ProjectA  -- project_a.war
>     mod1 --mod1.jar
>         src/java
>         web
>     mod2 -- mod2.jar
>         src/java
>         web
>     mod3
>     .......
> ..........

> To use maven & eclipse, Should be creating project & subprojects and
> convert them to eclipse project ??  Since mod1, mod2 etc are
> identical in the directory structure , I think it is a overkill to
> create various subprojects. The source code mod1, mod2 etc are in
> Clearcase. How do I move forward? Thanks for your help. 

True enough, there is a dilemma, and there is no obvious solution.

The Eclipse way is to set up each module as a separate project,
declare dependencies between them using Eclipse UI. This lets you
use Eclipse for daily edit-copile cycle. The downside of this approach
that you need fairly complicated custom Maven configuration for
assembling your application and for generating reports on the
whole codebase.

The Maven way is to set up a single elicpse project with subdirectories
for each module and use simple and standard reactored build. At the
same time you will need a fairly complicated Eclipse build path setup
to take advantage of the builtin incremental compiler, and other
features. Note that in a reactored build you'll get separate reports
for each module, unless you come up with a non-standard Maven configuration.

R.


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