Source / library exchange between sbt and Scala play framework

I have two related applications that I am developing in Scala. One of them is a server data processor built using SBT, and headless execution of a number of crunches (on a cron job). Another is a website written in Scala and running on a playback platform.

I have a code that I would like to share between them, but since each of them (SBT and Play) has their own ideas about the directory structure and how to create things, it is not clear to me how I should do this. I would not like to copy and paste .scala files, but I also do not really like to use sym links and their assembly from the same files.

If it were possible, I would agree to get Play scripts to run SBT to create libraries as needed. If this was the only way, I would also be fine using SBT to build cans for Play and then copy them to their place. But I often develop both at the same time (they are part of a larger application), and they will all work much more smoothly if they are updated together. Is this possible, or if there is another simpler technique that I skip?

Thanks, Alex

+4
source share
1 answer

The only easy way is to create JARs with SBT and make Play use them.

How to copy, you have 2 options:

  • You manually create and copy them to the libs folder on Play (you can make the script less annoying).
  • You use a special repository for your JARs (ala Nexus repository) and use Play dependencies.yml to point to this repo and update. With this, you will also need to often run play sync --deps and configure versions, so I'm not sure if this makes too much sense during dev (it makes sense when JARs are completed, though)
+7
source

All Articles