Project directory for sbt sub-projects

can sbt subproject have its own directory project? or can only the root project design the directory using auxiliary .scala files for assembly ?. Below is my current structure. /my-project/sub-projects/sub-project-1/build.sbtcannot access the objects defined in /my-project/sub-projects/sub-project-1/SubProjectHelper.scala.

/my-project
  build.sbt
  /projects
    Helper.scala
  sub-projects
    sub-project-1
      build.sbt
      /projects
        SubProjectHelper.scala

Update: The following sbt definition in subproject-1 / build.sbt

lazy val localhost = (project in file(".")).settings (
    name := """localhost""",
    version := Common.version,
    scalaVersion := Common.scalaVersion,
    libraryDependencies ++= Common.dependencies,
    libraryDependencies ++= Localhost.dependencies
)

does not work with error below

    libraryDependencies ++= Localhost.dependencies
                            ^
sbt.compiler.EvalException: Type error in expression
    at sbt.compiler.Eval.checkError(Eval.scala:384)
    at sbt.compiler.Eval.compileAndLoad(Eval.scala:183)
    at sbt.compiler.Eval.evalCommon(Eval.scala:152)
    at sbt.compiler.Eval.evalDefinitions(Eval.scala:122)
    at sbt.EvaluateConfigurations$.evaluateDefinitions(EvaluateConfigurations.scala:271)
    at sbt.EvaluateConfigurations$.evaluateSbtFile(EvaluateConfigurations.scala:109)
    at sbt.Load$.sbt$Load$$loadSettingsFile$1(Load.scala:712)

Common is defined in / my -project / projects / Common.scala and has no problems. But Localhost is defined in / my -project / sub-projects / sub-project-1 / projects / SubProjectHelper.scala is not resolved correctly in the sub-project-1 build.sbt file

+4
source share
2 answers

, , sub-projects dir, sub-project-1 my-project dir.

0

( , , scala/scala-seed.g8). s, .

projects project.

0

Source: https://habr.com/ru/post/1629842/


All Articles