问题
We currently have a big Maven 2 project that is rather a collection of many single standalone projects with complicated dependencies, with the exception of some common parent POMs for building. In the end we always have to ship the application as one piece, so I would rather like to convert it to one or a few big projects.
Does anyone have experience in how to optimize continuous integration builds for big projects. Is the incremental build functionality of Maven or Hudson any good? I would prefer not to wait always 2 hours when having made only a small change in one module.
On the other hand, to be sure, you always would have to rebuild and re-test at least all direct and indirect dependencies of a changed module. That is also what we are currently doing with Hudson, triggering automatically all dependent jobs.
Does a split up into multiple build jobs for the same project pay off? I generally do not like to have artifacts on the server where all the other generated stuff like reports, docs, etc. could possibly be out of date.
Thanks for any thoughts.
回答1:
I would highly suggest not to split up into different build jobs. This, in my experience, can get out of hand quickly with upstream and downstream dependencies. Incremental building works great for what you need it for. If the dependencies are set directly only artifacts that change and their dependencies are rebuilt.
I would split up the build jobs though if they are completely separate applications with no or very few dependnecies (if thats true then they shouldn't be under the same reactor and thus the incremental builds would not be possible)
回答2:
I just did some more testing and as I found out Maven does not really support incremental builds. Without any plugins Maven actually has a dangerous behavior. If you change the code in some module and compile without prior clean, dependent modules will not get rebuilt, meaning they then reference an old outdated version of the dependency and will not react to the updated code.
With the incremental build plugin it is possible to build without clean. Every module that changed gets rebuilt plus all dependents will be cleaned and rebuilt. However, in my case compiling uses only like 10% of the build time, 90% are for testing. And when I install/deploy all tests get executed again, so the time benefit from the incremental build plugin is very small.
So I still only see the option of splitting up builds in Hudson which is hardly ideal in my opinion.
来源:https://stackoverflow.com/questions/6281699/maven-incremental-building