No Scala bytecode produced when building mixed Scala/Java project with clashing filenames


(Julien Sirocchi) #1

I have a mixed Java/Scala project with the following structure:

___bar
|____src
| |____test
| | |____scala
| | | |____a
| | | | |____b
| | | | | |____FooTest.scala
___foo
|____src
| |____main
| | |____java
| | | |____a
| | | | |____b
| | | | | |____Foo.java
| | |____scala
| | | |____a
| | | | |____b
| | | | | |____Foo.scala

In Foo.java the Foo interface is defined, while in Foo.scala the FooComponent trait and the FooComponentImpl object are defined.

When assembling the foo.jar no Scala bytecode is produced, thus subproject bar cannot even test compile.

I have created a simple project to reproduce here https://github.com/sirocchj/name-clash

Tested with:

$ gradle --version
  ------------------------------------------------------------
Gradle 1.10
------------------------------------------------------------
  Build time:
 2013-12-17 09:28:15 UTC
Build number: none
Revision:
   36ced393628875ff15575fa03d16c1349ffe8bb6
  Groovy:
     1.8.6
Ant:
        Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy:
        2.2.0
JVM:
        1.7.0_45 (Oracle Corporation 24.45-b08)
OS:
         Mac OS X 10.9.2 x86_64

(Peter Niederwieser) #2

Thanks for the sample project. I’ve raised GRADLE-3050. This looks like a problem with the Scala Ant task or Gradle’s use thereof. After switching to the Zinc compiler (which may become the default in the future), the problem goes away:

tasks.withType(ScalaCompile) {
    scalaCompileOptions.useAnt = false
}