18

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?

Jari
  • 2,152
  • 13
  • 20
Jakub Korab
  • 4,974
  • 2
  • 24
  • 34

4 Answers4

8

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.

Biju Kunjummen
  • 49,138
  • 14
  • 112
  • 125
  • 1
    That'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
4

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.

Jakub Korab
  • 4,974
  • 2
  • 24
  • 34
3

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.

ailveen
  • 583
  • 3
  • 14
1

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

Anton Arhipov
  • 6,479
  • 1
  • 35
  • 43