I need to import an object named JavaCCParser into another object which is in a different package named frontend. But it can not find. I think I write the correct path.
I add a dependency in pom.xml in frontend package and then solved it. add denpendency
CodePudding user response:
Those don't look like they are in the same module (folder with a blue box, contains its own src root).
To use packages from another module would require you to import the module as a dependency in the other module in the build.sbt.
Something like (for a project-wide build.sbt):
lazy val root = project
.in(file("."))
.aggregate( neoForJAstFactory, frontend, ... )
... // Other config stuff
lazy val neoForJAstFactory = project
.in(file("neo4j-ast-factory"))
... // Other config stuff
lazy val frontend = project
.in(file("frontend"))
.dependsOn(neoForJAstFactory)
... // Other config stuff
Once you add the module as a dependency to the module you wish to use it in, the package should be available for import (it should be in-scope).
Here is the sbt doc: Multi-Project
