Question

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.
Était-ce utile?

La solution

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)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top