blue-sky
blue-sky

Reputation: 53916

Setting up Scala project

Is there a standard in place for setting up a Scala project where the build.sbt is contained in a subdirectory?

I've cloned https://github.com/lightbend/cloudflow and opened it in IntelliJ, here is the structure:

enter image description here

Can see core contains build.sbt.

If I open the project core in a new project window then IntelliJ will recognise the Scala project.

How to compile the Scala project core while keeping the other folders available within the IntelliJ window?

Upvotes: 0

Views: 60

Answers (1)

Randomness Slayer
Randomness Slayer

Reputation: 724

EDIT: If you do want to play around with the project, it should suffice to either import an SBT project and select core as the root. Intellij should also detect the build.sbt if you open core as the root.


Here is the SBT Reference Manual

Traditionally, build.sbt will be at the root of the project.

If you are looking to use their libraries, you should import them in your sbt file, you shouldn't clone the repo unless you intend to modify or fork their repo.

For importing libraries into your project take a look at the Maven Repository for Cloudflow, select the project(s), click on the version you want, and select the SBT tab. Just copy and paste those dependencies into your build.sbt. Once you build the project with SBT, you should have all those packages available to you.

So in [ProjectRoot]/build.sbt something along the lines of

val scalaVersion = "2.13.4"

lazy val root = (project in file("."))
  .settings(
    name := "Your_Project_Name",
    scalaVersion := scalaVersion,
    libraryDependencies += "com.lightbend.cloudflow" %% "cloudflow-streamlets" % "2.0.26-RC12",
        // Either sequentially
    libraryDependencies += "com.lightbend.cloudflow" %% "cloudflow-akka" % "2.0.26-RC12",
        // Or as a sequence (note that you can have a trailing comma for these)
    libraryDependencies ++= Seq(
        "com.lightbend.cloudflow" %% "cloudflow-blueprint" % "2.0.26-RC12",
        "com.lightbend.cloudflow" %% "cloudflow-flink" % "2.0.26-RC12", // No next elemenet
    )
        // Or combo using both like above, just don't forget the commas in between
  )

Upvotes: 1

Related Questions