Compiling Scala code with Gradle 1.4 is smooth. Running Scala tests with Gradle 1.4 seems not well supported, yet. I used the following Ant-based code.
{code} apply plugin: ‘scala’
repositories {
mavenCentral() }
dependencies {
compile ‘org.scala-lang:scala-library:2.10.0’
testCompile ‘org.scalatest:scalatest_2.10:1.9.1’ }
tasks.withType(ScalaCompile) {
// use zync-based incremental compiler
scalaCompileOptions.useAnt = false }
task scalaTest(dependsOn: testClasses) << {
ant.taskdef(name: ‘scalatest’,
classname: ‘org.scalatest.tools.ScalaTestAntTask’,
classpath: sourceSets.test.runtimeClasspath.asPath
)
ant.scalatest(runpath: sourceSets.test.compileClasspath,
fork: ‘false’,
haltonfailure: ‘true’,
suite: ‘TranslatorTest’)
{ reporter(type: ‘stdout’) } } {code}
-
Can someone please comment if this is currently the best way to run Scala tests?
-
How can I make the scalaTest task participate in the incremental build when using the zync based compiler? (I’m not sure how I have to defined the inputs and outputs)
-
How can I configure ant.scalatest such that the scalatest output is printed on the console even if I don’t explicitly run the Gradle build with the -i option?
-
Do you plan to provide a ScalaTest task as part of the Gradle scala plugin?
Thanks for any help. Regards, Etienne