问题
I am trying to add a non-play Java project as a sub-project. The main project is a Play Java Application and the sub-project is in the same directory as the main-project. I am following instruction given here. My build.sbt looks like
import play.Project._
name := "main-project"
version := "1.0"
libraryDependencies ++= Seq(javaJdbc, javaEbean)
playJavaSettings
lazy val mainProject = project.in(file("."))
.aggregate(subProject)
.depends(subProject)
lazy val subProject = project.in(file("../sub-projects/sub-project-1"))
Here is my directory structure
D:
|-- projects
| |-- main-project
| |-- sub-projects
| | | |-- sub-project-1
| | | |-- sub-project-2
When I try to compile the main project, I get the following error.
[info] Loading project definition from D:\projects\main-project\project
D:\projects\main-project\build.sbt:13: error: value depends is not a member of sbt.Project
possible cause: maybe a semicolon is missing before `value depends'?
.depends(subProject)
^
[error] sbt.compiler.EvalException: Type error in expression
[error] Use 'last' for the full log.
回答1:
It should be dependsOn
not depends
.
You should also point to both projects from the folder root:
name := "java-test"
version := "1.0-SNAPSHOT"
playJavaSettings
lazy val mainProject = project.in(file("."))
.aggregate(subProject, playProject)
.dependsOn(subProject, playProject)
lazy val subProject = project.in(file("sub-projects/sub-project-1"))
//play project depends on subProject...
lazy val playProject = project.in(file("play-project")).dependsOn(subProject)
来源:https://stackoverflow.com/questions/21730323/play-framework-2-2-1-adding-non-play-java-project-as-sub-project