diff options
author | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-19 07:10:07 -0800 |
---|---|---|
committer | Li Haoyi <haoyi.sg@gmail.com> | 2018-02-19 07:10:07 -0800 |
commit | aded4d9c3cd073f170e3c5f76df9a5910104b654 (patch) | |
tree | ac2c497aa2697bb733993882d7f16917ee520200 /docs/pages/2 - Configuring Mill.md | |
parent | addfbdb327f2d45b70422c2bccf0cdc8618c5b91 (diff) | |
download | mill-aded4d9c3cd073f170e3c5f76df9a5910104b654.tar.gz mill-aded4d9c3cd073f170e3c5f76df9a5910104b654.tar.bz2 mill-aded4d9c3cd073f170e3c5f76df9a5910104b654.zip |
more configuration examples
Diffstat (limited to 'docs/pages/2 - Configuring Mill.md')
-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 |