I'm looking for a plugin that would run in a console continuously to scan a Maven project's test sources directory, and when it detects a change kicks off a test cycle. Something analogous to mvn scala:cc
or the Scala Build Tool, but for Java. Can anyone point me towards one?

- 2,152
- 13
- 20

- 4,974
- 2
- 24
- 34
-
2This might be obvious but, you are aware that there are continuous integration servers with good support for maven, right? e.g. [Jenkins-CI](http://jenkins-ci.org/) – Miquel Jul 05 '12 at 15:56
-
1Yeah, I do. I am looking for something simple out of the box to run in a console alongside a text editor when I don't have access to a full-blown IDE. – Jakub Korab Jul 05 '12 at 16:00
-
1Ok, all clear. You want eclipse's autobuild functionality minus eclipse :) – Miquel Jul 05 '12 at 16:01
-
That's pretty much it :) – Jakub Korab Jul 05 '12 at 16:12
-
but jenkins offer a consloe command interface to manipulate it – Moataz Elmasry Jul 09 '12 at 11:02
4 Answers
I have personally used sbt even for a java only project just for continuous test feature.
I added a sbt build file to a maven based project and use sbt when developing, but use maven when building the final package, starting embedded jetty etc and this has worked out quite well.

- 49,138
- 14
- 112
- 125
-
1That's certainly one way to do it, but I'm looking for something that wouldn't require me to introduce sbt. – Jakub Korab Jul 06 '12 at 09:24
-
It's quite possible that there isn't actually a Maven continuous compilation plugin, so this is the best answer that I received. Thanks! – Jakub Korab Jul 17 '12 at 08:47
I've just discovered that the scala-maven-plugin supports both continuous compilation & testing, as well as cross-compilation (Java + Scala). So it's possible to use it over a pure Java build and get all the continuous build goodness.

- 4,974
- 2
- 24
- 34
-
You're a genius, sir! :D It worked. see also http://stackoverflow.com/a/4079288/539481 – Paweł Prażak Apr 21 '15 at 18:31
Recently, I have had a need for a solution to this. Having been learning scala and finding about the goodness of sbt ~test, I want to apply it to Java projects that do not have continuous test.
Using the scala-maven-plugin that you mentioned, I have created a github seed that will run Java Junit tests everytime I save a Java source or a Java test.
Check it out: https://github.com/ailveen/maven-scala-java-continuous-test
The project is very simple right now (contains only Java files because that is my current need) but in the future I hope to add scala test (or specs2 or scalacheck) so it works with mixed java and scala files.
Hope you find it useful.

- 583
- 3
- 14
It is not exactly for Maven, but JUnit Max does continuous testing and if you're on Eclipse it might be the tool you would like to check out

- 6,479
- 1
- 35
- 43