3
votes

I'm using Play! with Scala and including a couple of java classes in the source tree. Everything worked until I started including source classes directly in the tree.

It seems that whenever I try to compile the app with a folder like app/com/class/class.java (double-checked the imports are properly structured) the app simply won't compile. It will boot up in the prompt and get to "API phase took..." and hang.

I've adapted a class https://github.com/collegeman/stringtotime/blob/master/src/main/java/com/clutch/dates/StringToTime.java#L242 and stripped out the spring framework.

I'm hoping someone might have some insight about mixing java and scala files in a Play! app. What would be the proper method to do so and have it compile?

Edit: I've tried this on multiple OSs and JDK6 and JDK7 so it doesn't seem isolated to a particular platform. Using Play! 1.2.4.

Edit 2: It's quite possible this is related to a Java function, but not sure yet. If I simply create an empty class the app compiles, so my suspicion is that somewhere during bootup the StringToTime class in the link above creates a problem. Looking for known bugs or conflicts.

Thanks!

1

1 Answers

0
votes

I haven't done this in Play, but we have a scala project built using sbt (which is what Play is based on). Basically, the java source code needs to go in a separate directory structure. For vanilla sbt, this would be src/main/java.

http://www.javacodegeeks.com/2012/05/deploy-play-framework-2-apps-to.html may help you out.