Play directory structure

367 views
Skip to first unread message

Paul Draper

unread,
Mar 17, 2015, 2:28:01 AM3/17/15
to play-fram...@googlegroups.com
Has it been considered (I'm sure it has....) 

Play is deeply invested/integrated with SBT. It is an SBT auto plugin, it makes heavy use of sbt-web, etc.
It's great. I can leverage my understanding and process to a much wider community.

So it comes as a bit of a surprise that Play apps have a different directory structure than other SBT projects. I'm guessing that comes from a pre-SBT past?
It's a bit disorienting and causes a few funny things, like test/resources being a resource directory, whereas test/com or test/org, or even test/resource are source directories.
I'm not even sure what the equivalent to assets/ or public/ is for tests. (?)

It would be nice to standard the default layout to other match every other Java, Scala, sbt-web, and twirl project.
This structure is also familiar to Maven users, of which there are no small number.

/
  src/
    main/
      assets/
      java/
      public/
      resources/
      scala/
      twirl/
    test/
      assets/
      java/
      public/
      resources/
      scala/
      twirl/

None of these directories conflict with the current Play defaults; there is probably a migration path that preserves functionality for users with the old layout.

Ben McCann

unread,
Mar 17, 2015, 2:47:48 AM3/17/15
to Paul Draper, play-fram...@googlegroups.com
You can do this in 2.4 simply by calling disablePlugins(PlayLayoutPlugin)

I haven't thoroughly tested it though, so if you're interested in it, it could definitely use a bit of QA. I think especially when it comes to packaging it could use some help. I'm guessing these two lines are probably wrong and need to be fixed:

-Ben


--
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-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Paul Draper

unread,
Mar 17, 2015, 2:55:06 AM3/17/15
to play-fram...@googlegroups.com, pauld...@gmail.com
Thanks! I'll take a look.

naturallog

unread,
Mar 17, 2015, 5:15:55 AM3/17/15
to play-fram...@googlegroups.com, pauld...@gmail.com
Does the IDE integration work for this folder structure ? Eclipse ? IntelliJ ?
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.

Ben McCann

unread,
Mar 17, 2015, 5:27:09 AM3/17/15
to naturallog, play-fram...@googlegroups.com, Paul Draper
Yes. At least i know it works with Eclipse. I don't use IntelliJ. But there shouldn't be any hardcoded references to directories. E.g. here's the Eclipse support:

To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

benmccann

unread,
Mar 17, 2015, 3:54:32 PM3/17/15
to play-fram...@googlegroups.com, blnar...@gmail.com, pauld...@gmail.com
Here's an unrelated bug that hits the same line of code I think might break our ability to disable the PlayLayoutPlugin. We should fix both issues at once
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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.

James RopR

unread,
Mar 17, 2015, 6:53:48 PM3/17/15
to benmccann, play-fram...@googlegroups.com, naturallog, pauld...@gmail.com
With regards to IDE support - this is one of the nice things about sbt, there is a sourceDirectories task, and IDEs just need to run that to get a list of all the source directories, and then use those.  So, you can play with the directory layout as much as you want, and the IDEs should be happy with it.

In case you haven't seen it, read my series on sbt here:


To unsubscribe from this group and stop receiving emails from it, send an email to play-framework-...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
James RopR
Software Engineer

Typesafe – Build reactive apps!
Twitter: @jroper
Reply all
Reply to author
Forward
0 new messages