j3d
j3d

Reputation: 9724

Play Framework: how to refer to a template in another sub-project

Given the following multi-project Play application...

+ myApp
    + app
    + conf
    + modules
        + myModule1
        |    + app
        |    |  + controllers
        |    |  + models
        |    |  + views
        |    |      + main.scala.html
        |    + conf
        + myModule2
             + app
             |  + controllers
             |  + models
             |  + views
             |      + index.scala.html
             + conf        

... how do I call myModule1/app/views/main.scala.html from myModule2/app/views/index.scala.html? Is it possible to define a layout template once and then reuse it in all sub-projects?

Upvotes: 0

Views: 479

Answers (1)

adis
adis

Reputation: 5951

Are you folders sub projects or modules? In both cases you will need to edit the build.Scala.

In your case I would define a Core project and this core project will be referenced from the other subprojects:

val codePrj = play.Project(
  "App-myCore", appVersion, coreDeps, path = file("modules/myCore")
)

val myModule1 = play.Project(
  "App-myModule1", appVersion, moduleOneDeps, path = file("modules/myModule1")
).dependsOn(codePrj)

val myModule2 = play.Project(
  "App-myModule2", appVersion, moduleTwoDeps, path = file("modules/myModule2")
).dependsOn(codePrj)

Then your main project should glue everything together:

val main = play.Project(appName, appVersion, mainDeps).settings(
).dependsOn(myModule1, myModule2)

Upvotes: 1

Related Questions