Jake
Jake

Reputation: 4660

sbt subProject: dependsOn

I have the following build.sbt with two sub projects. Everything compiles and runs fine. One is a thin scala play project. dataextractor has a lot of util classes I want to call in the play project.

However, the configurarion below still leads to the following compilation error:

[error] /Users/foo.bar/_vws/com.corp.enablement.scripts/sirf_extract_serve/tools_sirf_server/app/corp/tools/es_result_server/service/SystemInitializer.scala:6:21: object dataextraction is not a member of package corp.tools [error] import corp.tools.dataextraction.providers.confluence

This is my first sbt multi-project. Advice would be genuinley appreciated

lazy val tools_dataextractor = (project in file("tools_dataextractor")).settings(
  Defaults.itSettings,
  libraryDependencies += scalatest % "it,test",
  name := "corp_tools_dataextractor",
  version := "0.1",
  mainClass in Compile := Some("corp.tools.ExtractionStartUp")
  )

lazy val tools_sirf_server = (project in file("tools_sirf_server")).settings(

  ).enablePlugins(PlayScala).dependsOn(tools_dataextractor)


lazy val root = (project in file("."))
    .aggregate(tools_dataextractor, tools_sirf_server)

Upvotes: 1

Views: 500

Answers (2)

Jake
Jake

Reputation: 4660

OK, the answer is neophyte error. I had a build.sbt in the root and a build.sbt in each sub project (which is permissible).

Everything will built fine.... Until I started adding dependencies from one sub-project to another. In this case, the super build.sbt "dependsOn" is ignored and compilation errors occur.

Side note, the main reason for keeping sub-project build.sbt was simply laziness. It took half a day to get everything working in a single build.sbt at the root level. However, it is defintiely worth the effort.

Upvotes: 2

pme
pme

Reputation: 14803

The configuration looks good.

2 possibilities what the problem might be:

  • You are in a sbt-console and haven't reloaded the console after you changed build.sbt
  • You work with Intellij and did not reload the sbt projects

If this does not help - adjust your question with the steps you take.

Upvotes: 1

Related Questions