diff options
-rw-r--r-- | docs/pages/2 - Configuring Mill.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/pages/2 - Configuring Mill.md b/docs/pages/2 - Configuring Mill.md index 36c5aace..1f733dbc 100644 --- a/docs/pages/2 - Configuring Mill.md +++ b/docs/pages/2 - Configuring Mill.md @@ -337,6 +337,41 @@ You can override `unmanagedClasspath` to point it at any jars you place on the filesystem, e.g. in the above snippet any jars that happen to live in the `foo/lib/` folder. +## Defining a Main Class + +```scala +// build.sc +import mill._, scalalib._ + +object foo extends ScalaModule { + def scalaVersion = "2.12.4" + def mainClass = Some("foo.bar.Baz") +} +``` + +Mill's `foo.run` by default will discover which main class to run from your +compilation output, but if there is more than one or the main class comes from +some library you cna explicitly specify which one to use. This also adds the +main class to your `foo.jar` and `foo.assembly` jars. + +## Custom Test Frameworks + +```scala +// build.sc +import mill._, scalalib._ + +object foo extends ScalaModule { + def scalaVersion = "2.12.4" + def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.0.4") + def testFramework = "org.scalatest.tools.Framework" +} +``` + +Integrating with test frameworks like Scalatest is simply a matter of adding it +to `ivyDeps` and specifying the `testFramework` you want to use. After that you +can [add a test suite](#adding-a-test-suite) and `mill foo.test` as usual, +passing args to the test suite via `mill foo.test arg1 arg2 arg3` + ## Downloading Non-Maven Jars ```scala |