clojure-maven-plugin icon indicating copy to clipboard operation
clojure-maven-plugin copied to clipboard

Plugin Not Running When Java Test Fails

Open DWiechert opened this issue 9 years ago • 5 comments

I have a Java, Scala, Clojure project and am using this plugin in that project. When running mvn test, if a Java or Scala test should fail, the Clojure tests never get ran.

Is this the intended behavior? I would think that the Clojure tests should be ran at the same time as the Java and Scala ones so ALL test failures can be reported at once. Whereas now, I have to fix the Java and Scala ones before seeing if I have failures in the Clojure code (or explicitly run `mvn clojure:test-with-junit).

DWiechert avatar Apr 16 '15 01:04 DWiechert

Could your problem be here: <junit.version>4.12</junit.version> <scalatest.version>3.0.0-SNAP4</scalatest.version> You are not listing a clojure test unit.

Phinneas avatar Apr 16 '15 04:04 Phinneas

In your POM.xml you list Junit, and Scalatest, but I do not find clojuretest.version.

Phinneas avatar Apr 16 '15 04:04 Phinneas

I can add that but I didn't see it in the doc anywhere that the clojure test dependency was necessary.

I actually think this is happening (not 100% sure) because the standard maven junit plugin is running on the test phase, it sees a Java or Scala error, and then maven errors out. This doesn't allow maven to pickup the clojure plugin on the test phase.

Is it possible to implement something along the lines of how the scala maven plugin handles this? Instead of having a test goal, they have a testCompile goal where it compiles the tests. Then it appears that the standard maven junit plugin picks up those tests and runs them at the same time as the Java ones - instead of after like the Clojure ones.

DWiechert avatar Apr 16 '15 14:04 DWiechert

Have you followed this link: http://alexott.net/en/clojure/ClojureMaven.html Is this what you are following?

Phinneas avatar Apr 21 '15 19:04 Phinneas

I see the problem here being that the java/scala tests are probably all being picked up by maven-surefire-plugin and being run, and are failing fast - which prevents the clojure test goal from running. I know that surefire now has an API for plugging in additional test runners, so we should be able to implement that and integrate with surefire, and then have the common reporting of errors.

See https://maven.apache.org/surefire/surefire-api/ for details if anyone wants to submit a PR...

talios avatar Jun 09 '15 12:06 talios