Where exactly does Play Framework load classes from? Directory Structure Guide?

Summary: I cannot find a guide to Play Framework directory structure which is consistent with what I observe in practice.

Context: I come from a J(2)EE/Spring background. I am fairly familiar with Scala, but not Play. While I appreciate syntactic sugar and “magic” as a productivity aid, I always like to know what goes on “under the hood”. To this end, after playing with one of the “focussed examples” on https://developer.lightbend.com/start/?group=play, I am making a Play application “from scratch”. Thus forcing me to understand the dependencies and configurations, step by step. Using Scala 2.12.8, with Gradle (using ‘scala’ and ‘play’ plugins), IDE: Idea.

Play version: 2.7.2 although I suspect that my issue is not version-specific.

Detail of the problem: I have imported play-guice as a dependency and created a dummy application loader as follows:

package group.mojo.rate.app

import play.api.inject.guice.{GuiceApplicationBuilder, GuiceApplicationLoader}

class DummyApplicationLoader extends GuiceApplicationLoader


I then point Play to this class with the following line in conf/application.conf:

If I run the application, the corresponding .class file is compiled to build/classes. However if I visit http://localhost:9000/ I get:

java.lang.ClassNotFoundException: group.mojo.rate.app.DummyApplicationLoader
... (stacktrace trimmed)...

Now according to Anatomy of a Play Application the classes should be in target/classes. Thinking that perhaps the Gradle Play plugin and/or Idea is being too clever/opinionated for its own good, I have manually created target/classes and copied the generated classes (including, naturally, the package-hierarchy directory structure) to this folder. Then refresh or restart the app. However the same ClassNotFoundException occurs.

I suspect that I am missing something pretty obvious. If so please could someone point me to the appropriate documentation?

Update: the problem is caused by the gradle play plugin which has some very strong opinions, and does not follow the above-mentioned “Anatomy” 100%. I have now found a fix for the above issue, which however breaks unit tests and also Intellij build. Will post a detailed solution once this is all sorted.