build.sbt 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // The simplest possible sbt build file is just one line:
  2. scalaVersion := "2.13.8"
  3. // That is, to create a valid sbt build, all you've got to do is define the
  4. // version of Scala you'd like your project to use.
  5. // ============================================================================
  6. // Lines like the above defining `scalaVersion` are called "settings". Settings
  7. // are key/value pairs. In the case of `scalaVersion`, the key is "scalaVersion"
  8. // and the value is "2.13.8"
  9. // It's possible to define many kinds of settings, such as:
  10. name := "spark-exam"
  11. organization := "ch.epfl.scala"
  12. version := "1.0"
  13. // Note, it's not required for you to define these three settings. These are
  14. // mostly only necessary if you intend to publish your library's binaries on a
  15. // place like Sonatype.
  16. // Want to use a published library in your project?
  17. // You can define other libraries as dependencies in your build like this:
  18. val sparkVersion = "3.4.1"
  19. libraryDependencies := List(
  20. "com.lihaoyi" %% "requests" % "0.8.0",
  21. "com.lihaoyi" %% "upickle" % "3.1.0",
  22. "com.lihaoyi" %% "os-lib" % "0.9.1",
  23. "org.apache.spark" %% "spark-core" % sparkVersion,
  24. "org.apache.spark" %% "spark-sql" % sparkVersion,
  25. )
  26. // Here, `libraryDependencies` is a set of dependencies, and by using `+=`,
  27. // we're adding the scala-parser-combinators dependency to the set of dependencies
  28. // that sbt will go and fetch when it starts up.
  29. // Now, in any Scala file, you can import classes, objects, etc., from
  30. // scala-parser-combinators with a regular import.
  31. // TIP: To find the "dependency" that you need to add to the
  32. // `libraryDependencies` set, which in the above example looks like this:
  33. // "org.scala-lang.modules" %% "scala-parser-combinators" % "2.1.1"
  34. // You can use Scaladex, an index of all known published Scala libraries. There,
  35. // after you find the library you want, you can just copy/paste the dependency
  36. // information that you need into your build file. For example, on the
  37. // scala/scala-parser-combinators Scaladex page,
  38. // https://index.scala-lang.org/scala/scala-parser-combinators, you can copy/paste
  39. // the sbt dependency from the sbt box on the right-hand side of the screen.
  40. // IMPORTANT NOTE: while build files look _kind of_ like regular Scala, it's
  41. // important to note that syntax in *.sbt files doesn't always behave like
  42. // regular Scala. For example, notice in this build file that it's not required
  43. // to put our settings into an enclosing object or class. Always remember that
  44. // sbt is a bit different, semantically, than vanilla Scala.
  45. // ============================================================================
  46. // Most moderately interesting Scala projects don't make use of the very simple
  47. // build file style (called "bare style") used in this build.sbt file. Most
  48. // intermediate Scala projects make use of so-called "multi-project" builds. A
  49. // multi-project build makes it possible to have different folders which sbt can
  50. // be configured differently for. That is, you may wish to have different
  51. // dependencies or different testing frameworks defined for different parts of
  52. // your codebase. Multi-project builds make this possible.
  53. // Here's a quick glimpse of what a multi-project build looks like for this
  54. // build, with only one "subproject" defined, called `root`:
  55. // lazy val root = (project in file(".")).
  56. // settings(
  57. // inThisBuild(List(
  58. // organization := "ch.epfl.scala",
  59. // scalaVersion := "2.13.8"
  60. // )),
  61. // name := "hello-world"
  62. // )
  63. // To learn more about multi-project builds, head over to the official sbt
  64. // documentation at http://www.scala-sbt.org/documentation.html