Can I compile dependency Scala projects in Maven using mixed Java and scala code?
I have a project of scala and Java code. I currently use the scala ide plug-in to manage it in eclipse Currently, the organization directory structure enables some packages to have Java and scala code Some Scala classes depend on Java classes, and others depend on Scala classes The plug-in handles all this transparently - I believe (but I'm not 100% sure) that the scala compiler compiles Java and scala code together, which is the way cross dependencies are handled I did find some references to compile hybrid projects using Maven e.g. here, but what I saw was that Java and scala were divided into two separate source trees Maven tried to compile Scala code first because it relied on Java code and failed Similarly, if you compile java code first, it will fail because the dependencies are bidirectional Is there a way for Maven to compile all the code like an Eclipse Plug-in? I also hope to be able to generate an eclipse project without too much manual repair if possible
Solution
The usual Maven directory structure is
src/ main/ java/ com/foo/mypackage/ scala/ com/foo/mypackage/
If you set it this way, you can certainly have cross dependencies between Java and scala code For this topic, see the Maven Scala plugin or Scala Maven plugin page
I do not recommend putting Java and scala code in the same directory