I was working on a Maven project, all made up of Java, and recently I started mixing Scala code.
I am struck by the great expressiveness of Scala sentences, the easy use of the scala -maven-plugin and the particularly incredible interoperability between Java and Scala.
However, I hit one inconvenience; according to the Maven convention, the Java source code goes to src/main/java , whereas Scala to src/main/scala . I found this rather cumbersome because I often have to go back and forth Java and Scala source files, and every time I have to go through a deep hierarchy of package directories (I often close tabs so my editor is not cluttered).
So the question is : is it recommended to maintain separate directories src/main/java and src/main/scala ? If so, why?
To add more background, I worked on a Wicket web application map, the convention of which is to put HTML files along with the corresponding Java files. If we separate the directories, naturally, the HTML files will also be divided (I donβt think that using Scala files and corresponding HTML files in different directories makes sense). And then this happens, βWhy can't I find Foo.html? Oh, I was looking for the wrong directory.β
The source files themselves are very easy to distinguish between people and machines by checking their extensions. I configured pom.xml to process both Java and Scala compiled in src/main/java and it worked (compiles and runs). Directory splitting, on the other hand, creates the risk of defining conflicting classes in Java and Scala, a careless mistake.
Well, I do not want to name the java directory if it contains not only Java, but also Scala. But this is the only thing I can think of for directory splitting. (Edit: I came up with a workaround, let's think java means Java virtual machine. So having src/main/c does not contradict if we ever decided to use JNI because C does not run on the JVM.)
Oh, and one more thing; my project is not intended as an open source project; ease of development is preferable to trying to complicate the implementation of agreements.
This question is inspired by this answer .