Play Framework application layout with custom Java package name

It's not really obvious how you could use custom Java package namespace in play framework 2.4.x. The official doc simply has a one liner:

the controllers, models and views package name conventions are now just that

But now:

  • do you put the app folder under com.org?
  • What about the conf folder? also the public folder?
  • What about sub-projects?
  • Say you got it to work with activator you probably still can't get IntelliJ stop complaining about 'package name do not corresspond to path'?

So, I came up with a sample Play 2.4.x Java project that has the bare bone components to show how it could be done.

It showcases:

  1. the correct project folder structure
  2. config referencing modules from a custom package
  3. views referencing layouts and partials from a custom package
  4. views referencing models from a custom package
  5. views referencing helper from a sub-project library
  6. routes referencing controllers from a custom package
  7. build.sbt building solutions and internal library with custom packages

See Play Package Namespacing Example on GitHub

  1. MEAWin8Champs says:

    Ronald Widha: Play Framework application layout with custom Java package name: It's not really o... https://t.co/RWXQZCbtZ8 #meawin8champ