Play Framework 2.2.1 - Adding non-play Java Project as sub-project

岁酱吖の 提交于 2019-12-08 06:08:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!