You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Nathaniel Auvil <na...@gmail.com> on 2010/09/29 22:29:40 UTC

multi-module project versioning question

I am trying to figure out how to leverage mult-module builds in maven. Say i
have a project defined as:

parent
child-core
child-service
child-web

where both child-service and child-web are dependent on child-core


ok. i do a first release and everything is at version 1.0 as in:
parent (1.0)
child-core (1.0)
child-service (1.0)
child-web (1.0)


Some days later there is a bug in the child-web project. What i _want_ is...

parent (1.1)
child-core (1.0)
child-service (1.0)
child-web (1.1)

how can i do this with maven?

Re: multi-module project versioning question

Posted by Marshall Schor <ms...@schor.com>.
 I'm not a maven expert, so others may chime in with corrections/ improvements :-)

Here's how I think about this.

First, I separate out the idea of "parent" and "aggregator", using "parent" to
denote POMs that factor out common settings from their children, and using
"aggregator" to denote POMs that have a <modules> element, specifying
sub-projects to build together.

In fact, these can be entirely separate POMs - since they're for different purposes.
You could, even, have several different "aggregator" projects, over the same set
of sub-modules, if that made sense.

Then, for releasing, you have a choice:

1) release one (sub) project by itself
2) release several (sub) projects together
3) use an "aggregator" project to release several projects together.

So, in your case, you could release the aggregator project at level 1.0, and
then, if you no longer desired to have all the sub-projects at the same level
(as you seem to indicate), you could subsequently release just the child-web
project.

There could be potentially some difference in the builds done by default for an
aggregator project versus doing an individual sub-project build.  For instance,
a common practice is to have the "top-most" project (the aggregator, for
instance), do a consolidated source-release zip packaging over all the
submodules.  If you built just one project, that project would, of course, have
its own source-release zip package.

So, I think it's up to you, how you want to manage this. 

Does this make sense?  Or am I missing the main point?

-Marshall Schor

On 9/29/2010 4:29 PM, Nathaniel Auvil wrote:
> I am trying to figure out how to leverage mult-module builds in maven. Say i
> have a project defined as:
>
> parent
> child-core
> child-service
> child-web
>
> where both child-service and child-web are dependent on child-core
>
>
> ok. i do a first release and everything is at version 1.0 as in:
> parent (1.0)
> child-core (1.0)
> child-service (1.0)
> child-web (1.0)
>
>
> Some days later there is a bug in the child-web project. What i _want_ is...
>
> parent (1.1)
> child-core (1.0)
> child-service (1.0)
> child-web (1.1)
>
> how can i do this with maven?
>

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


Re: multi-module project versioning question

Posted by Brian Smith <bm...@gmail.com>.
What I find helped me tremendously when figuring out the best way to
organise our project is to look at examples.

Large scale open source projects like the spring framework and maven itself
are good places to learn.

regards

Brian

On 30 September 2010 13:32, Antonio Petrelli <an...@gmail.com>wrote:

> 2010/9/30 Nathaniel Auvil <na...@gmail.com>:
> > what does not make sense to you?
> >
> > If i only have a bug in the child-web project, i should not have to
> release
> > a new version of my child-service and child-core...those did not change.
>
> I understand the point, but its intrinsically wrong. When you fix
> something inside a module you are, in fact, fixing the whole project.
> Otherwise, if you want to manage those module separately, you'd better
> move them in a separate project.
> In fact, one main point of a multi-module project is to maintain the
> versions of modules all together.
>
> >  This is fundemental to multi-module projects and i do not see how maven
> can
> > not support this.  Releasing all modules of  a project at the same time
> does
> > not make sense in this case.
>
> You can try going in the module subdir and running the release plugin.
> It *might* work, however I strongly discourage it.
>
> > Right now i have separate projects for each module, but it is painful to
> do
> > builds and releases.
>
> Doing as I said in the sentence before is painful in the exact same
> way. It would be less painful if you tag only the main project.
>
> > Another issue with multi-module projects is how they have to live in
> > SVN...if you want to tag or branch, you have to tag or branch the entire
> > codebase, not just a single module.
>
> At this point I suppose you are managing projects in a wrong way. Why
> did you put the whole codebase under a single project?
> If it is only for sharing configuration, then create a separate master
> pom and use it as parent for all the other projects.
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: multi-module project versioning question

Posted by Antonio Petrelli <an...@gmail.com>.
2010/9/30 Nathaniel Auvil <na...@gmail.com>:
> what does not make sense to you?
>
> If i only have a bug in the child-web project, i should not have to release
> a new version of my child-service and child-core...those did not change.

I understand the point, but its intrinsically wrong. When you fix
something inside a module you are, in fact, fixing the whole project.
Otherwise, if you want to manage those module separately, you'd better
move them in a separate project.
In fact, one main point of a multi-module project is to maintain the
versions of modules all together.

>  This is fundemental to multi-module projects and i do not see how maven can
> not support this.  Releasing all modules of  a project at the same time does
> not make sense in this case.

You can try going in the module subdir and running the release plugin.
It *might* work, however I strongly discourage it.

> Right now i have separate projects for each module, but it is painful to do
> builds and releases.

Doing as I said in the sentence before is painful in the exact same
way. It would be less painful if you tag only the main project.

> Another issue with multi-module projects is how they have to live in
> SVN...if you want to tag or branch, you have to tag or branch the entire
> codebase, not just a single module.

At this point I suppose you are managing projects in a wrong way. Why
did you put the whole codebase under a single project?
If it is only for sharing configuration, then create a separate master
pom and use it as parent for all the other projects.

Antonio

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


Re: multi-module project versioning question

Posted by Wendy Smoak <ws...@gmail.com>.
On Thu, Sep 30, 2010 at 7:34 AM, Nathaniel Auvil
<na...@gmail.com> wrote:
> what does not make sense to you?
>
> If i only have a bug in the child-web project, i should not have to release
> a new version of my child-service and child-core...those did not change.
>  This is fundemental to multi-module projects and i do not see how maven can
> not support this.  Releasing all modules of  a project at the same time does
> not make sense in this case.

If you expect this to happen often, then I agree with the advice
you're getting that perhaps this module should be managed separately.

If it's a one-off patch that you need to get out quickly then:
1. change the <parent><version> in the child to the prior released
version of the parent
2. go into the child and release:prepare, release:perform
2a. when prompted, add an extra section to the version -- say you
released 2.0, and the project now sits at 2.1-SNAPSHOT.  So you
release 2.0.1 of the child and set the version back to 2.1-SNAPSHOT
after the release.
3. put the <parent><version> in the child back to the correct value

There is an argument to release it all together, which is that you
know it has all been built and tested together.  If you start
releasing the modules separately, then you will have to do additional
testing and keep a compatibility matrix of which bits work together.
You'll notice that most open source projects just release the entire
thing even if only a few modules have changed -- it's less work
overall.

-- 
Wendy

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


Re: multi-module project versioning question

Posted by Nathaniel Auvil <na...@gmail.com>.
what does not make sense to you?

If i only have a bug in the child-web project, i should not have to release
a new version of my child-service and child-core...those did not change.
 This is fundemental to multi-module projects and i do not see how maven can
not support this.  Releasing all modules of  a project at the same time does
not make sense in this case.

Right now i have separate projects for each module, but it is painful to do
builds and releases.

Another issue with multi-module projects is how they have to live in
SVN...if you want to tag or branch, you have to tag or branch the entire
codebase, not just a single module.


On Thu, Sep 30, 2010 at 3:40 AM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> 2010/9/29 Nathaniel Auvil <na...@gmail.com>:
> > Some days later there is a bug in the child-web project. What i _want_
> is...
> >
> > parent (1.1)
> > child-core (1.0)
> > child-service (1.0)
> > child-web (1.1)
> >
> > how can i do this with maven?
>
> Sorry but this does not make sense: either you use separated projects,
> or a project-module structure.
> Nothing prevents you to separate the child-web module into an
> independent project.
>
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: multi-module project versioning question

Posted by Antonio Petrelli <an...@gmail.com>.
2010/9/29 Nathaniel Auvil <na...@gmail.com>:
> Some days later there is a bug in the child-web project. What i _want_ is...
>
> parent (1.1)
> child-core (1.0)
> child-service (1.0)
> child-web (1.1)
>
> how can i do this with maven?

Sorry but this does not make sense: either you use separated projects,
or a project-module structure.
Nothing prevents you to separate the child-web module into an
independent project.

Antonio

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