Building Play with sbt 1

34 views
Skip to first unread message

Rich Dougherty

unread,
Jan 30, 2018, 6:52:38 PM1/30/18
to play-fram...@googlegroups.com
Hi Play contributors

We've just released a version of interplay that's cross-built for sbt 0.13 and sbt 1. Interplay provides a set of sbt plugins to provide common settings for Play projects and modules. Interplay handles common details, such as the Scala versions we use and where we publish the code when we do a release.
sbt 1 is nicer to use - we can use Scala 2.12 and it should be easier to use with Java 9.

Now that the interplay plugins have been cross-built we can start updating the Play projects (playframework, play-json, twirl, play-ws, etc) to build with sbt 1.

End-user Play projects can already be built with either sbt 0.13 or sbt 1, but Play itself is currently built using sbt 0.13.

Tips when updating Play projects to sbt 1
 
It can be tricky updating projects to use sbt 1. Often you'll just see a long list of errors that need to be worked through. :)

When I'm updating projects from sbt 0.13 to sbt 1 I use an incremental process. I usually switch the build.properties file to sbt 1.0.4, fix the first error I get, then switch the build.properties back to sbt 0.13.16. That way I can check that the build still works after making changes.

This means that the build is always in a reasonable state so I can't get into too much of a mess! After doing this for a while, the build works in both sbt 0.13 and sbt 1. At that point its safe to switch to sbt 1 and delete any sbt 0.13 code - but you might want to leave the sbt 0.13 code in place for a little while just in case there are any issues with the update.

The interplay plugins include some code to help with compatibility between both sbt 0.13 and sbt 1. You can use this code in your projects by importing interplay.PlaySbtCompat.


If you need to write your own code to help with compatibility you have two choices.

1. You can add the code to interplay's PlaySbtCompat object. This will be available to any project that uses interplay, but you will need to release a new version of interplay.
2. If the code is only needed for one project then you can add code into that project's project/src/main/scala-sbt-{0.13,1.0} directories. This code will be compiled and available in that project's build.sbt file.

(I have added some play-json and playframework compatibility code into the PlaySbtCompat project. At some point it should probably be moved into those projects instead of shared between all projects.)

The recommended version of sbt to use is now 1.0.4. I know that sbt 1.1.x is out, but I had some trouble upgrading interplay to build with that version - some issue with the sbt-buildinfo plugin. That's something I'll try to sort out in the future. Since the sbt 1 interplay plugin that has been released is technically binary compatible with sbt 1.0.x and 1.1.x it might work if you try updating your project to sbt 1.1. You can try it and see. If it doesn't work, it might be easier to stick to sbt 1.0.4 for now.

Let me know if you have any questions or issues.

Cheers
Rich


--
Rich Dougherty
Engineer, Lightbend, Inc

Dominik Dorn

unread,
Feb 2, 2018, 8:11:19 AM2/2/18
to Rich Dougherty, play-fram...@googlegroups.com
Just FYI: Using SBT 1.1.0 for Play based Projects works like a charm.. already have 3 projects
running it (and the dev-speed feels way better than with SBT 1.0).

Cheers,
Dominik


--
You received this message because you are subscribed to the Google Groups "Play framework dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-dev+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages