0
votes

I have a play 2.3.10 app with several strcuture:

├── app
│   └── Global.java
├── build.sbt
├── conf
│   ├── application.conf
│   ├── messages
│   ├── play.plugins
│   ├── routes
├── modules
│   ├── common
│   ├── frontend
│   ├── backend
├── project
│   ├── build.properties
│   ├── Common.scala
│   ├── plugins.sbt

And inside modules/frontend/app/ I have FrontendGlobal.java. Now I run "activator" in the base project folder, and then "project frontend" and finally "run"

The play application for that sub-project is started, but NO Global file is executed. I thought the root Global.java will be executed, but adding a trace in @onStart does not print anything. Even changing the file FrontendGlobal.java (in modules/frontend/app) to Global.java does not do any effect.

What is wrong here?

Just as additional information, my build.sbt from the base project contains:

lazy val common = project.in(file("modules/common")).enablePlugins(play.PlayJava)
lazy val frontend = project.in(file("modules/frontend")).enablePlugins(play.PlayJava).dependsOn(common)
lazy val backend = project.in(file("modules/backend")).enablePlugins(play.PlayJava).dependsOn(common)
lazy val root = (project in file(".")).enablePlugins(play.PlayJava).dependsOn(common, frontend, backend).aggregate(common, frontend, backend)

UPDATED: Just my fault, in the frontend-application.conf I had application.global=globals.FrontendGlobal

1
Answer to your question and mark it as resolved to avoid people clicking whereas your problem is solved ;) - c4k

1 Answers

0
votes

Every project should contain only one Global.java (as they can only have one application.conf and routes. The subprojects could have a Subproject-Global.java and you can reference it from the project application.conf (subproject-application.conf) as follows:

application.global=Subproject-Global