build.sbt 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. libraryDependencies := List(
  19. "com.lihaoyi" %% "requests" % "0.8.0",
  20. "com.lihaoyi" %% "upickle" % "3.1.0",
  21. "com.lihaoyi" %% "os-lib" % "0.9.1"
  22. )
  23. // Here, `libraryDependencies` is a set of dependencies, and by using `+=`,
  24. // we're adding the scala-parser-combinators dependency to the set of dependencies
  25. // that sbt will go and fetch when it starts up.
  26. // Now, in any Scala file, you can import classes, objects, etc., from
  27. // scala-parser-combinators with a regular import.
  28. // TIP: To find the "dependency" that you need to add to the
  29. // `libraryDependencies` set, which in the above example looks like this:
  30. // "org.scala-lang.modules" %% "scala-parser-combinators" % "2.1.1"
  31. // You can use Scaladex, an index of all known published Scala libraries. There,
  32. // after you find the library you want, you can just copy/paste the dependency
  33. // information that you need into your build file. For example, on the
  34. // scala/scala-parser-combinators Scaladex page,
  35. // https://index.scala-lang.org/scala/scala-parser-combinators, you can copy/paste
  36. // the sbt dependency from the sbt box on the right-hand side of the screen.
  37. // IMPORTANT NOTE: while build files look _kind of_ like regular Scala, it's
  38. // important to note that syntax in *.sbt files doesn't always behave like
  39. // regular Scala. For example, notice in this build file that it's not required
  40. // to put our settings into an enclosing object or class. Always remember that
  41. // sbt is a bit different, semantically, than vanilla Scala.
  42. // ============================================================================
  43. // Most moderately interesting Scala projects don't make use of the very simple
  44. // build file style (called "bare style") used in this build.sbt file. Most
  45. // intermediate Scala projects make use of so-called "multi-project" builds. A
  46. // multi-project build makes it possible to have different folders which sbt can
  47. // be configured differently for. That is, you may wish to have different
  48. // dependencies or different testing frameworks defined for different parts of
  49. // your codebase. Multi-project builds make this possible.
  50. // Here's a quick glimpse of what a multi-project build looks like for this
  51. // build, with only one "subproject" defined, called `root`:
  52. // lazy val root = (project in file(".")).
  53. // settings(
  54. // inThisBuild(List(
  55. // organization := "ch.epfl.scala",
  56. // scalaVersion := "2.13.8"
  57. // )),
  58. // name := "hello-world"
  59. // )
  60. // To learn more about multi-project builds, head over to the official sbt
  61. // documentation at http://www.scala-sbt.org/documentation.html