Package not found for mixed scala and java build

I have a project with mixed Scala and Java code. The project structure is standard as :

src–> main–> java src–> main–> scala src–> test --> java

src–> test --> scala

When I do a gradle build, the compilation fails saying : :compileJava error : package does not exist.

Both my java and scala codes are inter dependent and they import packages from the other. Here gradle is not able to find the package that is inside scala, and imported in a java file.

How do I fix this ?

I had the same problem several months ago. I found the solution and blogged it. It’s at

Let me know if this helps.

Great. This solved the problem.

Thanks a lot.