davidB/maven-scala-plugin — Issue #70: Can't mix Java and Scala source in src/test/scala if scala compiler is run first
Author: gashcrumb
Created: 2011-12-08 20:12:47+00:00
State: open

I have a test module I'm working on that has both Java and Scala, so I configured maven-scala-plugin to execute first via:

org.scala-tools
maven-scala-plugin
${maven-scala-plugin-version}

scala-compile-first
process-resources

add-source
compile

scala-test-compile
process-test-resources

testCompile

-deprecation
-P:continuations:enable

org.scala-lang.plugins
continuations
${scala-version}

org.fusesource.jvmassert
jvmassert
1.2

-Xmx1024m
-Xss8m

${scala-version}

org.apache.maven.plugins
maven-compiler-plugin
${maven-compiler-plugin-version}

compile

compile

However my build would mysteriously fail with "duplicate class" compilation errors. Turning on debugging showed that during the test compile phase the maven-compiler-plugin was being passed a list of two paths for compileSourceRoots that are effectively the same:

```
[DEBUG] (f) compileSourceRoots = [${project.baseDir}/src/test/scala, ${project.baseDir}/src/test/scala/../scala]
```

So the plugin was passing each Java file on the compiler command line twice.

I figured out via the maven-scala-plugin source to work around this by explicitly setting:

```src/test/scala```

so it's not a huge deal, but still a bug.