I've found the sbt-groovy plugin and it properly compiles both the test and the main sources just fine. However, the definedTests
key is always empty; SBT never discovers any groovy tests. I've verified this with a very simple single src/test/groovy/Test.groovy
with a single method annotated @Test
which should be picked up by the junit-interface.
I think the root of the issue is that the sbt-groovy plugin needs to define the task "definedTests" in its own plugin source code. This task provides a Seq[TestDefinition]
.
Looking at how SBT itself populates the sequence reveals it uses additional output from the scala compiler (which also happens to compile java files, so it works out of the box for java) in an Analysis
class which is populated by output from the IncrementalCompiler
I've fiddled around with the taskdef, but I'm not sure I'm even on the right path. Documentation on this stuff is pretty sparse, or heavily connected to the IncrementalCompiler
.
What code do I need in sbt-groovy to produce a Seq[TestDefinition]
that satisfies SBT so that I can run tests (picked up by the junit-interface) that are written in Groovy?