tags:

views:

23

answers:

1

We're considering using Maven for a large multi project build, to give you an idea of the size, some of the sub-projects have several million lines of code.

The ideal structure would be something like:

  • projectA
    • module1
    • module2
  • projectB
    • moduleAlpha (depends on moduleBeta)
    • moduleBeta (depends on projectA:module1)
  • ...

Where each module is actually a maven sub-project, and the dependencies are not always at the artifact level (i.e. jars), but rather cause the sub-project to be compiled as necessary.

Adding a common project root allows for expressing the dependencies as described, for example:

  • project-root
    • projectA
      • module1
      • module2
    • projectB
      • moduleAlpha (depends on moduleBeta)
      • moduleBeta (depends on projectA:module1)
    • ...

But forces you to build from project-root. Remember that this is a very large project, and a full build would be something that is not always desirable.

Most teams work at the projectX level some even at the moduleX level.

What we need is to sometimes build against a generated artifact (that is the jar produced by module1), other times we want to build from the source code.

I have taken a look at the reactor plugin, that allows you to resume a build from a certain point or build only the dependents. But it seems very manual (although it is very useful in certain cases).

What I picture is some type artifact repository that builds the artifact when it is required. For example, making projectA an artifact repository that projectB references. When you for some reason need a rebuild of projectA's artifact, you could just remove the jar.

Is something like that implemented as part of Maven or as a plugin? If not, is it feasible to implement?

+2  A: 

What we need is to sometimes build against a generated artifact (that is the jar produced by module1), other times we want to build from the source code.

I don't see any particular problem here:

  • when you want to build against binary dependencies (jars), just build the artifact you're working on (and let Maven resolve and use binary dependencies)
  • when you want to build against source code, use a reactor build and the advanced reactor options, for example to build the dependencies of moduleAlpha and moduleAlpha:

    mvn -pl moduleAlpha -am
    

What I picture is some type artifact repository that builds the artifact when it is required. For example, making projectA an artifact repository that projectB references. When you for some reason need a rebuild of projectA's artifact, you could just remove the jar.

I'm not sure to understand what you're talking about and removing JARs doesn't sound like a good idea.

What you need is a continuous build process that builds the whole project as often as possible to produce SNAPSHOT of all modules and deploy them in a corporate repository. That's just the way to go.

And to make the build as fast as possible, I'd consider using Maven 3.x and the parallel builds option.

Pascal Thivent