问题
I have:
- main project
- sub project called "shopping"
I would like to use views from main project inside the subproject. My code of sub project controller:
package controllers.shopping;
public class Application extends Controller {
public static Result index() {
return ok(views.html.confirmation.render("ok"));
}
}
And my main build file
lazy val shopping = project.in(file("modules/shopping"))
val main = project.in(file("."))
.dependsOn(shopping).aggregate(shopping)
My model class in submodule common:
@Entity
public class AppMode {
public static AppMode getCurrentConfigurationEntry() {
return JPA.em().find(AppMode.class, 1L);
}
}
回答1:
Since main depends on shopping adding a dependency the other way around as well would create a circular dependency so sbt wouldn't be able to know which project to build first.
Break the logic you want out into a second subproject that you depend on from both shopping and main and you will be able to access them in both shopping and main.
来源:https://stackoverflow.com/questions/25763647/play2-using-main-project-views-controllers-models-in-submodule-subproject-and-in