Search code examples
javaplayframework

Play Framework: How to change play default packages?


I was just wondering if it is possible to change the default packages from Play. For example: I want to change the "controllers" package to "com.test.controllers". I don't know if this makes any sense, but I just want to know how if it is possible. I did not find anything related to this in play website.


Solution

  • Updated to make the distinction between play1 and 2 clear.

    For Play 1.x, this is not possible.

    No, all controllers must be in a package, or sub package of controllers. If you wanted to keep a com.test package structure, you can do controllers.com.test

    For more info, see this thread.

    For Play2.x, this is possible. Just move everything to the package you desire. Make sure that the outermost app/ directory stays at outside. An example would be play-project/app/com.company/controllers.

    So the simple answer is...it depends, on whst version of Play you are using.