views:

2882

answers:

5

I'm using a local artifactory to proxy the request, but the build and test phases are still a bit slow. It's not the actual compile and tests that are slow, it's the "warmup" of the maven2 framework. Any ideas?

+3  A: 

I don't know what version of Maven you are using, I assume 2, but I will give what I use for Maven 1.x to speed up and make things build a tiny bit quicker.

These will fork the junit tests into a new process (also helps when you use environment variables in tests etc and gives the tests a little more memory.

-Dmaven.junit.fork=true
-Dmaven.junit.jvmargs=-Xmx512m

This forks the compilation which might speed things up for you

-Dmaven.compile.fork=true

I hope this can help a little, try it out.

Also refer to get more speed with your maven2 build.

PintSizedCat
I'm using maven2 but it's a nice link and I'll definitely try that patched version for my downloads.However the issue was more build and test startup times...
Sebastian
+2  A: 

I've found that parsing reactor projects is significantly slower than single-pom projects. If your build is reactor (multi-module) and your developers are not working on all modules at the same time, you can remove the parent POM and build them separately, resolving the dependencies using the local repo. The disadvantage is that you need to install or deploy a module in order for its dependents to see the changes.

Also, you might want to look at the new Maven 2.1 M1 which contains some significant speed improvements.

If none of these helps, post more details about your project configuration (modules structure and plugins), command line parameters and hardware config (memory and disk). Running Maven with -X might also show where is it taking its time.

ddimitrov
it is indeed a reactor projct that I'm using. three small modules and a webprojekt.I tried that 2.1 build and it did seem a little faster.
Sebastian
+3  A: 

There are some possibilities to optimize some of the build tasks. For example the 'clean' task can be optimized from minutes to just milliseconds using simple trick - rename 'target' folder instead of delete.

To get details how to do it refer to Speed up Maven build.

neat tricks, I'm often wasting undue time on the clean task too.
Sebastian
+1  A: 

I'd use locally installed Nexus.

Sergey Aldoukhov
Nexus is good too. I've used both nexus and artifactory, and they're both pretty fast. Nexus is a bit easier to configure IMO
Sebastian
buildr might also work.
gatoatigrado
+1  A: 

I did also write an article with some new ideas

http://www.waltercedric.com/java-j2ee-mainmenu-53/361-maven-build-system/1360-get-more-speed-with-your-maven2-build.html

hope that help

cedric.walter