Is it possible to tell Maven2 to execute every jUnit test in new JVM instance (fork) in serial mode, i.e. one by one.
You have to fork the JVM like explained here
org.apache.maven.plugins
maven-surefire-plugin
2.9
always
It should also be possible by just declaring a Sytem property
mvn -DforkMode=always test
As described in the documentation: "always" forks for each test-class. I do not know if the "pertest" setting will fork for each test.
Thanks to @Djebel for pointing out that forkMode is deprecated now. There is a detailed documentation on "Fork Options and Parallel Test Execution" and how to use the new parameters forkCount and reuseForks and that also includes the following migration tips:
Old Setting New Setting
forkMode=once (default) forkCount=1 (default), reuseForks=true (default)
forkMode=always forkCount=1 (default), reuseForks=false
forkMode=never forkCount=0
forkMode=perthread, threadCount=N forkCount=N, (reuseForks=false, if you did not had that one set)