Reputation: 267177
I have 2 separate projects:
core
Core contains all the dependencies, it is compiled and published locally using sbt clean assembly publishLocal
(using sbt-assembly plugin to build a fatjar). api then adds core as a dependency in build.sbt.
Problem is - none of the dependencies declared in core's build.sbt seem to be getting added to api - i get ClassNotFound
errors until I add each dependency individually to api
Any ideas how to fix this?
Upvotes: 0
Views: 476
Reputation: 14803
If it is a Multi-Module Project make sure that api
depends on core:
lazy val api = project.in(file("./api"))
.settings(api.settings)
.settings(api.dependencies)
.dependsOn(core)
See here for more information: SBT Multi-Project
If not you need a dependency in the api
Project, like:
libraryDependencies += "com.mycompany" % "myproject-core" % "2.0.0-SNAPSHOT"
Make sure the path, name and version are correct. Check the output from sbt publishLocal
. It should look like:
[info] published myproject-core_2.12 to /Users/YOU/.ivy2/local/com/mycompany/myproject-core_2.12/2.0.0-SNAPSHOT/jars/myproject-core_2.12.jar
Make sure to restart SBT
, and that the api
project with its dependencies is loaded correctly.
Also not that Test
dependencies are not inherited.
Upvotes: 2