0
votes

I'm new with the Play framework, and looks everything very straightforward, I have just one issue still: Which are the ways to handle a multiproject dependence with it?

I've tried to follow this but I cannot use the import http://www.playframework.com/documentation/2.2.1/SBTSubProjects

Something like this How to import custom package in JAVA in PLAY framework

But I have to import development code, is there a way to avoid to compile it to JAR every time?

I would like to avoid to integrate this separate project in the code and I would like to keep it externally, maybe in a custom folder like lib, called "ext" or such.

As already mentioned, I would like to know if there are different ways to handle such a thing, how would you do that?

1

1 Answers

3
votes

You have three options, none of them matches all your wishes:

  1. Do not separate the code, but avoid using 'clean compile' and instead let the incremental compilation in play help you by just compiling what is changed and what needs to be compiled as best as it can. This option will not package the sources in a separate artifact.

  2. Separate the code into a play/sbt submodule, this will give you a separate project that generates an artifact (jar-file), you can use dependsOn and aggregate to make your main project autogenerate it when needed, and include it in the classpath of your main project. This option will make it so that you do not have to compile it unless you actually changed that subproject.

  3. Separate the code into a totally separate project, using a modern build tool, sbt, maven or maybe gradle and let that tool publish the artifact and then depend on it just as you would with a third party dependency. This would allow you to build the project with any build tool, making it possible to make it a generic library that does not depend on play.

I would recommend you to spend some time reading the sbt docs or maybe even a book rather than trying to do this by trial and error. The 'SBT in action' early access from Manning is pretty good for example, the sbt docs are also pretty good: http://www.scala-sbt.org