SoftMemes
SoftMemes

Reputation: 5712

How do I use Maven as a sane build system?

Yes, this is a real question.

I want to cater for the following workflow in a multi module Maven based project:

Module Y may directly or indirectly depend on module X, I need all modules affected by a change to another to be compiled, recursively. I do not want tests to be run.

How, in Maven, do I do this without having to compile and install everything every time?

Upvotes: 3

Views: 169

Answers (2)

Andrew T Finnell
Andrew T Finnell

Reputation: 13638

Why do you have to make and install everytime? The easiest solution I've found is mvn install one time. Then you can go into individual projects and build them whenever you want. If you need to ensure the chain is picked up just do the build from the top and use mvn -amd -pl projectname

This says to build a specific project and it's dependencies.

Upvotes: 3

kan
kan

Reputation: 28981

Development stage

I don't think you could do it easily with the maven only. During development however you could skip tests adding -DskipTests.

The maven cannot do incremental compilation properly. The right way to do it is to use IDE which will import maven projects into IDE's projects and then you could have fast and easy development. IntelliJ IDEA works quite well with the maven.

Production stage

For release build you could use explicit versions in the target artifact. So after changes in module X if you building the final release artifact module Y you could add explicit dependency in it. In this case all modules between X and Y will have older version (but you should assume they will work with the new X which is always not true).

Upvotes: 1

Related Questions