You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Josh Stone <pa...@gmail.com> on 2010/01/24 22:55:20 UTC

Multi-project organization

I'm in the process of moving our company over to Maven, and am not sure of
the best way to organize our existing projects. Currently our application
stack consists of two dozen projects with various dependencies on each
other. For projects that a developer is actively working on, these should be
built locally from source whereas dependencies on all other projects should
be resolved from jars in the maven repository. I've setup 1 pom for each
project, but there are a few things I'm not sure about:

Since any given project could be built locally from source or from jars, do
I need two poms for each project, one to serve as a "build" pom and one to
reference jars?
Should I store the pom(s) in SCM along with having them in the maven
repository?

Any tips are appreciated,
Josh

Re: Multi-project organization

Posted by Josh Stone <pa...@gmail.com>.
Thanks for the responses Ron and everyone. I'm going to take back all of
your input and try to apply it.

Josh

On Sun, Jan 24, 2010 at 5:44 PM, Ron Wheeler <rwheeler@artifact-software.com
> wrote:

> I am still new to Maven after using it for 3 years with 20+ projects.
> I recently installed the Nexus repository manager, community (free)
> version.
> It is a great help and  I would heartily recommend installing it if you are
> moving to Maven.
> It makes the whole process much more visible.
>
> We use the Springsource version of Eclipse which supports Maven very well -
> great POM editor.
>
> You can take my advice with a grain of salt. There are others with more
> experience and understanding.
> 1) I would set up projects for each of the jars that you need to make.
>
> 2) I would set up individual projects that create the POM files to describe
> the overall dependencies.
> These POMS can be used as dependencies in your applications to pick up the
> right version of your jars.
> I would also build POM projects for dependencies from third parties
> We have POM files that have "compile" scope dependencies on all of the
> shared jars that we get from third parties (Apache, javax, etc). These are
> referenced by the POMs that produce war files, as "provided" so that the
> jars are available for compiling but are not in the war files since we
> install the jars in the container's (Tomcat) shared library folder.
> We have several POMs describing families of 3rd party jars. One for
> spring-hibernate-mysql-tomcat for our basic technology stack, one for
> utilities, mostly Apache stuff and one for the Apace CXF Web Service
> libraries for our projects that are Web Services.
>
> 3) Put the version numbers of the jars in the POM file of the dependent
> POMs so that when you have a dependency on a pom-shared-utility pom you get
> a full set of consistent jars for the version of your application. This
> reduces the potential for errors by developers. Once you start on a new
> version of your application and decide on a set of libraries that will be
> used, you define the version in the appropriate POM and the developer only
> have to set the dependency on the version of the group POM to get all the
> right versions.
>
> 4) Use SNAPSOTS properly with your development process. Nexus helps with
> this by enforcing disciplines.
>
> 5) Do not get discouraged by the terrible documentation. There is lots of
> it but it is very much "inside the beltway". Accurate but too hard to
> understand. The software works very well and there are a lot of tools to
> make maven do whatever you need.
>
> 6) Ask here. The community is really helpful if occasionally too cryptic.
>
> Good luck, you have made a good decision to get properly structured using
> maven
>
> Ron
>
>
> Josh Stone wrote:
>
>> I'm in the process of moving our company over to Maven, and am not sure of
>> the best way to organize our existing projects. Currently our application
>> stack consists of two dozen projects with various dependencies on each
>> other. For projects that a developer is actively working on, these should
>> be
>> built locally from source whereas dependencies on all other projects
>> should
>> be resolved from jars in the maven repository. I've setup 1 pom for each
>> project, but there are a few things I'm not sure about:
>>
>> Since any given project could be built locally from source or from jars,
>> do
>> I need two poms for each project, one to serve as a "build" pom and one to
>> reference jars?
>> Should I store the pom(s) in SCM along with having them in the maven
>> repository?
>>
>> Any tips are appreciated,
>> Josh
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Multi-project organization

Posted by Ron Wheeler <rw...@artifact-software.com>.
I am still new to Maven after using it for 3 years with 20+ projects.
I recently installed the Nexus repository manager, community (free) version.
It is a great help and  I would heartily recommend installing it if you 
are moving to Maven.
It makes the whole process much more visible.

We use the Springsource version of Eclipse which supports Maven very 
well - great POM editor.

You can take my advice with a grain of salt. There are others with more 
experience and understanding.
1) I would set up projects for each of the jars that you need to make.

2) I would set up individual projects that create the POM files to 
describe the overall dependencies.
These POMS can be used as dependencies in your applications to pick up 
the right version of your jars.
I would also build POM projects for dependencies from third parties
We have POM files that have "compile" scope dependencies on all of the 
shared jars that we get from third parties (Apache, javax, etc). These 
are referenced by the POMs that produce war files, as "provided" so that 
the jars are available for compiling but are not in the war files since 
we install the jars in the container's (Tomcat) shared library folder.
We have several POMs describing families of 3rd party jars. One for 
spring-hibernate-mysql-tomcat for our basic technology stack, one for 
utilities, mostly Apache stuff and one for the Apace CXF Web Service 
libraries for our projects that are Web Services.

3) Put the version numbers of the jars in the POM file of the dependent 
POMs so that when you have a dependency on a pom-shared-utility pom you 
get a full set of consistent jars for the version of your application. 
This reduces the potential for errors by developers. Once you start on a 
new version of your application and decide on a set of libraries that 
will be used, you define the version in the appropriate POM and the 
developer only have to set the dependency on the version of the group 
POM to get all the right versions.

4) Use SNAPSOTS properly with your development process. Nexus helps with 
this by enforcing disciplines.

5) Do not get discouraged by the terrible documentation. There is lots 
of it but it is very much "inside the beltway". Accurate but too hard to 
understand. The software works very well and there are a lot of tools to 
make maven do whatever you need.

6) Ask here. The community is really helpful if occasionally too cryptic.

Good luck, you have made a good decision to get properly structured 
using maven

Ron

Josh Stone wrote:
> I'm in the process of moving our company over to Maven, and am not sure of
> the best way to organize our existing projects. Currently our application
> stack consists of two dozen projects with various dependencies on each
> other. For projects that a developer is actively working on, these should be
> built locally from source whereas dependencies on all other projects should
> be resolved from jars in the maven repository. I've setup 1 pom for each
> project, but there are a few things I'm not sure about:
>
> Since any given project could be built locally from source or from jars, do
> I need two poms for each project, one to serve as a "build" pom and one to
> reference jars?
> Should I store the pom(s) in SCM along with having them in the maven
> repository?
>
> Any tips are appreciated,
> Josh
>
>   


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


RE: Multi-project organization

Posted by Jeff Jensen <je...@upstairstechnology.com>.
Just configure Maven settings.xml file to pull from the organization repo
(the one populated by CI builds).
The deps in the projects you are working on will get pulled from the repo.


-----Original Message-----
From: Josh Stone [mailto:pacesysjosh@gmail.com] 
Sent: Sunday, January 24, 2010 4:18 PM
To: Maven Users List
Subject: Re: Multi-project organization

Thanks for the response. Allow me to try and explain again:

Since our stack is so large and consists of many projects, developers don't
build the entire stack from source, they only build the specific projects
that they work on. Dependencies on other projects in our stack should be
resolved from jars that are built by our continuous integration box and
deployed to the maven repository. So if I'm actively developing only two
projects I'd only want to build those two projects from source. All the
other project dependencies I'd want to be pulled in from the maven
repository as jars. I'm not sure how to manage this...

Josh

On Sun, Jan 24, 2010 at 2:03 PM, Wendy Smoak <ws...@gmail.com> wrote:

> On Sun, Jan 24, 2010 at 2:55 PM, Josh Stone <pa...@gmail.com> wrote:
>
> > Since any given project could be built locally from source or from jars,
> do
> > I need two poms for each project, one to serve as a "build" pom and one
> to
> > reference jars?
>
> No, you don't need two poms.  What do you mean by building from source
> or from jars?  The source jars in the Maven repo are generally for
> IDEs to use when debugging.  The pom that builds the project will
> usually have <dependencies> on other jars.
>
> > Should I store the pom(s) in SCM along with having them in the maven
> > repository?
>
> Yes, the pom belongs in scm along with the project source code.  This
> is the same pom that gets deployed to the Maven repo when you do a
> release.
>
> Ideally the conversion will go bottom up, so that you convert your
> lower level utility jars, release them, then move up to the projects
> that depend on them.  To bootstrap you may want to deploy some
> existing jars to the your internal Maven repo for projects to use.
> For those you'll need to construct a pom or let Maven generate a
> minimal one.
>
> I'm not sure I understood the question, so ask again if that's not
> what you were looking for.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


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


Re: Multi-project organization

Posted by Stephen Connolly <st...@gmail.com>.
2010/1/24 Manuel Grau <ma...@gmail.com>

> Is exactly what I'm doing. I only build the project I'm working on. The
> dependencies are pulled from my local repository. Run mvn clean package
> install from your jars.


FYI, since install includes all the phases up to install, and package is <
install, mvn package install will build everything twice

if you want to install in the local repository, just mvn install will
suffice

-Stephen


> Only if you change any of them, you execute mvn
> package install. I'm not sure if you understand me.
>
> 2010/1/24 Josh Stone <pa...@gmail.com>
>
> > Thanks for the response. Allow me to try and explain again:
> >
> > Since our stack is so large and consists of many projects, developers
> don't
> > build the entire stack from source, they only build the specific projects
> > that they work on. Dependencies on other projects in our stack should be
> > resolved from jars that are built by our continuous integration box and
> > deployed to the maven repository. So if I'm actively developing only two
> > projects I'd only want to build those two projects from source. All the
> > other project dependencies I'd want to be pulled in from the maven
> > repository as jars. I'm not sure how to manage this...
> >
> > Josh
> >
> > On Sun, Jan 24, 2010 at 2:03 PM, Wendy Smoak <ws...@gmail.com> wrote:
> >
> > > On Sun, Jan 24, 2010 at 2:55 PM, Josh Stone <pa...@gmail.com>
> > wrote:
> > >
> > > > Since any given project could be built locally from source or from
> > jars,
> > > do
> > > > I need two poms for each project, one to serve as a "build" pom and
> one
> > > to
> > > > reference jars?
> > >
> > > No, you don't need two poms.  What do you mean by building from source
> > > or from jars?  The source jars in the Maven repo are generally for
> > > IDEs to use when debugging.  The pom that builds the project will
> > > usually have <dependencies> on other jars.
> > >
> > > > Should I store the pom(s) in SCM along with having them in the maven
> > > > repository?
> > >
> > > Yes, the pom belongs in scm along with the project source code.  This
> > > is the same pom that gets deployed to the Maven repo when you do a
> > > release.
> > >
> > > Ideally the conversion will go bottom up, so that you convert your
> > > lower level utility jars, release them, then move up to the projects
> > > that depend on them.  To bootstrap you may want to deploy some
> > > existing jars to the your internal Maven repo for projects to use.
> > > For those you'll need to construct a pom or let Maven generate a
> > > minimal one.
> > >
> > > I'm not sure I understood the question, so ask again if that's not
> > > what you were looking for.
> > >
> > > --
> > > Wendy
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>
>
>
> --
> "Everything should be made as simple as possible, but not simpler" Albert
> Einstein
>

Re: Multi-project organization

Posted by Josh Stone <pa...@gmail.com>.
I think I get what you are saying. So each project should have dependencies
on its jars, and I just choose to build each project if I want, otherwise
the dependencies will be resolved from the jars.

josh

On Sun, Jan 24, 2010 at 2:28 PM, Manuel Grau <ma...@gmail.com> wrote:

> Is exactly what I'm doing. I only build the project I'm working on. The
> dependencies are pulled from my local repository. Run mvn clean package
> install from your jars. Only if you change any of them, you execute mvn
> package install. I'm not sure if you understand me.
>
> 2010/1/24 Josh Stone <pa...@gmail.com>
>
> > Thanks for the response. Allow me to try and explain again:
> >
> > Since our stack is so large and consists of many projects, developers
> don't
> > build the entire stack from source, they only build the specific projects
> > that they work on. Dependencies on other projects in our stack should be
> > resolved from jars that are built by our continuous integration box and
> > deployed to the maven repository. So if I'm actively developing only two
> > projects I'd only want to build those two projects from source. All the
> > other project dependencies I'd want to be pulled in from the maven
> > repository as jars. I'm not sure how to manage this...
> >
> > Josh
> >
> > On Sun, Jan 24, 2010 at 2:03 PM, Wendy Smoak <ws...@gmail.com> wrote:
> >
> > > On Sun, Jan 24, 2010 at 2:55 PM, Josh Stone <pa...@gmail.com>
> > wrote:
> > >
> > > > Since any given project could be built locally from source or from
> > jars,
> > > do
> > > > I need two poms for each project, one to serve as a "build" pom and
> one
> > > to
> > > > reference jars?
> > >
> > > No, you don't need two poms.  What do you mean by building from source
> > > or from jars?  The source jars in the Maven repo are generally for
> > > IDEs to use when debugging.  The pom that builds the project will
> > > usually have <dependencies> on other jars.
> > >
> > > > Should I store the pom(s) in SCM along with having them in the maven
> > > > repository?
> > >
> > > Yes, the pom belongs in scm along with the project source code.  This
> > > is the same pom that gets deployed to the Maven repo when you do a
> > > release.
> > >
> > > Ideally the conversion will go bottom up, so that you convert your
> > > lower level utility jars, release them, then move up to the projects
> > > that depend on them.  To bootstrap you may want to deploy some
> > > existing jars to the your internal Maven repo for projects to use.
> > > For those you'll need to construct a pom or let Maven generate a
> > > minimal one.
> > >
> > > I'm not sure I understood the question, so ask again if that's not
> > > what you were looking for.
> > >
> > > --
> > > Wendy
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
>
>
>
> --
> "Everything should be made as simple as possible, but not simpler" Albert
> Einstein
>

Re: Multi-project organization

Posted by Manuel Grau <ma...@gmail.com>.
Is exactly what I'm doing. I only build the project I'm working on. The
dependencies are pulled from my local repository. Run mvn clean package
install from your jars. Only if you change any of them, you execute mvn
package install. I'm not sure if you understand me.

2010/1/24 Josh Stone <pa...@gmail.com>

> Thanks for the response. Allow me to try and explain again:
>
> Since our stack is so large and consists of many projects, developers don't
> build the entire stack from source, they only build the specific projects
> that they work on. Dependencies on other projects in our stack should be
> resolved from jars that are built by our continuous integration box and
> deployed to the maven repository. So if I'm actively developing only two
> projects I'd only want to build those two projects from source. All the
> other project dependencies I'd want to be pulled in from the maven
> repository as jars. I'm not sure how to manage this...
>
> Josh
>
> On Sun, Jan 24, 2010 at 2:03 PM, Wendy Smoak <ws...@gmail.com> wrote:
>
> > On Sun, Jan 24, 2010 at 2:55 PM, Josh Stone <pa...@gmail.com>
> wrote:
> >
> > > Since any given project could be built locally from source or from
> jars,
> > do
> > > I need two poms for each project, one to serve as a "build" pom and one
> > to
> > > reference jars?
> >
> > No, you don't need two poms.  What do you mean by building from source
> > or from jars?  The source jars in the Maven repo are generally for
> > IDEs to use when debugging.  The pom that builds the project will
> > usually have <dependencies> on other jars.
> >
> > > Should I store the pom(s) in SCM along with having them in the maven
> > > repository?
> >
> > Yes, the pom belongs in scm along with the project source code.  This
> > is the same pom that gets deployed to the Maven repo when you do a
> > release.
> >
> > Ideally the conversion will go bottom up, so that you convert your
> > lower level utility jars, release them, then move up to the projects
> > that depend on them.  To bootstrap you may want to deploy some
> > existing jars to the your internal Maven repo for projects to use.
> > For those you'll need to construct a pom or let Maven generate a
> > minimal one.
> >
> > I'm not sure I understood the question, so ask again if that's not
> > what you were looking for.
> >
> > --
> > Wendy
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>



-- 
"Everything should be made as simple as possible, but not simpler" Albert
Einstein

Re: Multi-project organization

Posted by Josh Stone <pa...@gmail.com>.
Thanks for the response. Allow me to try and explain again:

Since our stack is so large and consists of many projects, developers don't
build the entire stack from source, they only build the specific projects
that they work on. Dependencies on other projects in our stack should be
resolved from jars that are built by our continuous integration box and
deployed to the maven repository. So if I'm actively developing only two
projects I'd only want to build those two projects from source. All the
other project dependencies I'd want to be pulled in from the maven
repository as jars. I'm not sure how to manage this...

Josh

On Sun, Jan 24, 2010 at 2:03 PM, Wendy Smoak <ws...@gmail.com> wrote:

> On Sun, Jan 24, 2010 at 2:55 PM, Josh Stone <pa...@gmail.com> wrote:
>
> > Since any given project could be built locally from source or from jars,
> do
> > I need two poms for each project, one to serve as a "build" pom and one
> to
> > reference jars?
>
> No, you don't need two poms.  What do you mean by building from source
> or from jars?  The source jars in the Maven repo are generally for
> IDEs to use when debugging.  The pom that builds the project will
> usually have <dependencies> on other jars.
>
> > Should I store the pom(s) in SCM along with having them in the maven
> > repository?
>
> Yes, the pom belongs in scm along with the project source code.  This
> is the same pom that gets deployed to the Maven repo when you do a
> release.
>
> Ideally the conversion will go bottom up, so that you convert your
> lower level utility jars, release them, then move up to the projects
> that depend on them.  To bootstrap you may want to deploy some
> existing jars to the your internal Maven repo for projects to use.
> For those you'll need to construct a pom or let Maven generate a
> minimal one.
>
> I'm not sure I understood the question, so ask again if that's not
> what you were looking for.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Multi-project organization

Posted by Wendy Smoak <ws...@gmail.com>.
On Sun, Jan 24, 2010 at 2:55 PM, Josh Stone <pa...@gmail.com> wrote:

> Since any given project could be built locally from source or from jars, do
> I need two poms for each project, one to serve as a "build" pom and one to
> reference jars?

No, you don't need two poms.  What do you mean by building from source
or from jars?  The source jars in the Maven repo are generally for
IDEs to use when debugging.  The pom that builds the project will
usually have <dependencies> on other jars.

> Should I store the pom(s) in SCM along with having them in the maven
> repository?

Yes, the pom belongs in scm along with the project source code.  This
is the same pom that gets deployed to the Maven repo when you do a
release.

Ideally the conversion will go bottom up, so that you convert your
lower level utility jars, release them, then move up to the projects
that depend on them.  To bootstrap you may want to deploy some
existing jars to the your internal Maven repo for projects to use.
For those you'll need to construct a pom or let Maven generate a
minimal one.

I'm not sure I understood the question, so ask again if that's not
what you were looking for.

-- 
Wendy

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


Re: Multi-project organization

Posted by Manuel Grau <ma...@gmail.com>.
Let me introduce what I'm doing in my company. We have some
maven-java-simple projects used in other projects. These projects are
considered common code. Then, our projects are all maven-j2ee-simple
projects. These projects have a root pom. Then, we have inside a folder
called servlets, with at least a webapp inside. Then, a projects folder,
with some jar modules inside. Finally, we have the ear folder, with only a
project that generates an ear. We have another folder, called ejbs, to
create ejbs inside, but, as we are using Spring framework, we don't have any
ejb yet. This is the structure of a project:

/-root-project/
    -/ear/
    -/projects/
    -/servlets/
    -/ejbs/

2010/1/24 Josh Stone <pa...@gmail.com>

> I'm in the process of moving our company over to Maven, and am not sure of
> the best way to organize our existing projects. Currently our application
> stack consists of two dozen projects with various dependencies on each
> other. For projects that a developer is actively working on, these should
> be
> built locally from source whereas dependencies on all other projects should
> be resolved from jars in the maven repository. I've setup 1 pom for each
> project, but there are a few things I'm not sure about:
>
> Since any given project could be built locally from source or from jars, do
> I need two poms for each project, one to serve as a "build" pom and one to
> reference jars?
> Should I store the pom(s) in SCM along with having them in the maven
> repository?
>
> Any tips are appreciated,
> Josh
>



-- 
"Everything should be made as simple as possible, but not simpler" Albert
Einstein