Scala multi sbt project: object not included in package, type not found

How to import the abc class from the main project, which will be used by another class in the web project in the multi-project sbt ?

On sbt compile I get:
object abc is not a member of package com not found: type abc

Although compiling from IntelliJ is successful.

build.sbt

 lazy val main = project.in(file("main")) .settings(commonSettings: _*) lazy val web = project.in(file("web")) .settings(commonSettings: _*) .enablePlugins(PlayScala) .dependsOn(main) lazy val root = (project in file(".")) .dependsOn(web, main) .aggregate(web, main) .settings(commonSettings: _*) mainClass in root in Compile := (mainClass in web in Compile).value fullClasspath in web in Runtime ++= (fullClasspath in main in Runtime).value fullClasspath in root in Runtime ++= (fullClasspath in web in Runtime).value 

Inside the web project :

 package com.company.web.controllers import _root_.com.company.main.abc // also tried without root. // Intellij recognizes the import successuflly class Posts @Inject() (repo : abc) extends Controller { .. 

Inside the main project :

 package com.company.main class abc @Inject() (){ 

What could be wrong? Thanks.

+4
source share
1 answer

The output directory structure of the main project does not match the directory structure of maven , but is described here

 src/ main/ scala/ com/bla/bla test/ scala/ <test Scala sources 

Intellij successfully compiled the project, because whatever the previous directory structure was, it was marked as the source directory under File -> project structure -> modules -> sources

+4
source

All Articles