= Third-Party Plugins
:page-aliases: Thirdparty_Modules.adoc, Thirdparty_Plugins.adoc



The Plugins in this section are developed/maintained outside the mill git tree.
This list is most likely not complete.
If you wrote a Mill plugin or find that one is missing in this list, please open a {mill-github-url}/pulls[pull request] and add that plugin with a short description (in alphabetical order).

For details about including plugins in your `build.mill` read xref:extending/import-mvn-plugins.adoc[Using Mill Plugins].

CAUTION: Besides the documentation provided here, we urge you to consult the respective linked plugin documentation pages.
The usage examples given here are most probably incomplete and sometimes outdated!

Additional to this list, you can also search the https://github.com/topics/mill-plugin[`mill-plugin` topic on GitHub] for more plugins.


== Aliases

This plugin adds an opinionated way of defining aliases to Mill builds. Added aliases are global and applied to the whole build.

Project home: https://github.com/carlosedp/mill-aliases

[source,scala]
----
//| mvnDeps: ["com.carlosedp::mill-aliases::0.2.1"]

import mill.*, scalalib.*
import com.carlosedp.aliases.*

object foo extends ScalaModule {
  ...
}

object MyAliases extends Aliases {
  def testall     = alias("__.test")
  def compileall  = alias("__.compile")
  def comptestall = alias("__.compile", "__.test")
}
----

To show all the defined aliases:

[,console]
----
> ./mill Alias/list
----

Run an alias:

[,console]
----
> ./mill Alias/run testall
----

When run, each aliased task is checked if valid.

== Antlr

https://www.antlr.org/[ANTLR parser generator] support for mill.

Project home: https://github.com/ml86/mill-antlr


[source,scala]
----
//| mvnDeps: ["net.mlbox::mill-antlr:0.1.0"]

import net.mlbox.millantlr.AntlrModule

object foo extends ScalaModule, AntlrModule {
  override def antlrGrammarSources = Task.Sources("someGrammar.g4")
}
----

== AspectJ

https://projects.eclipse.org/projects/tools.aspectj[AspectJ compiler] support for mill.

Project home: https://github.com/lefou/mill-aspectj


[source,scala]
----
//| mvnDeps: ["de.tototec::de.tobiasroeser.mill.aspectj_mill0.9:0.3.1-12-89db01"]

import mill.*
import mill.scalalib.*
import mill.api.*

import de.tobiasroeser.mill.aspectj.*

object main extends AspectjModule {

  // Select the AspectJ version
  def aspectjVersion = "1.9.5"

  // Set AspectJ options, e.g. the language level and annotation processor
  // Run `mill main.ajcHelp` to get a list of supported options
  def ajcOptions = Seq("-8", "-proc:none")

}
----

For documentation, please refer to the https://github.com/lefou/mill-aspectj[project home page].

== Bash Completion

Limited bash completion support.

Project home: https://github.com/lefou/mill-bash-completion

== Bundler

`mill-bundler` is comparable to `scalajs-bundler` for `sbt`: It manages NPM dependencies for a Scala.js module and
bundling it. Currently Webpack and Rollup are implemented but it's easy to use another one.

Project home: https://github.com/nafg/mill-bundler


== CI Release

`mill-ci-release` is a wrapper around the existing publish functionality of
Mill with the aim to making releasing your project in GitHub Actions to Maven
easier by automating common setup such as setting up gpg in CI, setting up
versioning, and ensuring merges to into your main branch get published as a
SNAPSHOT. If you're coming from `sbt`, then you're likely familiar with
https://github.com/sbt/sbt-ci-release[`sbt-ci-release`] which this plugin
imitates.

Project home: https://github.com/ckipp01/mill-ci-release


To get started, you'll want to use `CiReleaseModule` as a drop in replacement
where you'd normally use the Mill `PublishModule` and then ensure you implement
everything that `PublishModule` requires.

Secondly, you'll need to ensure you have a few environment variables correctly
set in your GitHub repo. You can see detailed instructions on which are
necessary https://github.com/ckipp01/mill-ci-release#secrets[here].

Then in CI to publish you'll simply issue a single command:

[source,yaml]
----
- run: mill -i io.kipp.mill.ci.release.ReleaseModule/publishAll
----

This will automatically grab all the artifacts that you've defined to publish
in your build and publish them. Your version will automatically be managed by
https://github.com/lefou/mill-vcs-version[`mill-vcs-version`] and if your
version ends in `-SNAPSHOT` you're project will be published to Sonatype
Snapshots or to the normal releases if it's a new tag.


== Daemon

Use mill as a launcher for self-building systemd daemons,
convenient for quick editing and rebuilding of compiled templates,
or quick recompilation of code-as-config.


NOTE: This is a plugin adding functionality to mill. It should not be confused with mill's https://mill-build.org/mill/depth/process-architecture.html#_the_mill_daemon[internal long-lived daemon].

Project home: https://github.com/swaldman/mill-daemon

This example assumes your project directory is `/opt/coolproj`
Place the mill bootstrap script in your project directory.


./opt/coolproj/build.mill
----
//| mvnDeps: ["com.mchange::mill-daemon:0.2.1"]

import com.mchange.milldaemon.DaemonModule

object coolproj extends DaemonModule:
  override def runDaemonPidFile = defaultRunDaemonPidFile("coolproj")
----

This will cause PID files to be placed in the root of the project
directory as `coolproj.pid`. Of course, you can
https://github.com/swaldman/mill-daemon#more-on-rundaemonpidfile[place PID files anywhere you want],
or set this to `None` to refrain from generating PID files at all.

./opt/coolproj/rebuild-and-start
----
#!/usr/bin/env bash

./mill runMainDaemon coolproj.Main "$@"
----

./opt/coolproj/coolproj.service
----
[Unit]
Description=Cool Project
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/opt/coolproj/coolproj.pid
User=coolproj
Group=coolproj
WorkingDirectory=/opt/coolproj
ExecStart=/opt/coolproj/rebuild-and-start
Restart=on-failure

[Install]
WantedBy=multi-user.target
----

Symlink `/opt/coolproj/coolproj.service` from `/etc/systemd/system`, then `systemctl restart coolproj`.

== DGraph

Show transitive dependencies of your build in your browser.

Project home: https://github.com/ajrnz/mill-dgraph


[source,scala]
----
//| mvnDeps: ["com.github.ajrnz::mill-dgraph:0.2.0"]
----

[source,console]
----
> mill plugin.dgraph.browseDeps proj
----

== Docker Jib Packager

A wrapper around the  https://github.com/GoogleContainerTools/jib[Google Jib Library].
Allows to build Docker images without a running Docker daemon.
Also enables to layer an image more efficiently.

Project home: https://github.com/GeorgOfenbeck/mill-docker


== Docker Native-Image Packager

This plugin allows building Docker container images with GraalVM Native-Image
binaries for cloud-native and fast-startup applications.

Project home: https://github.com/carlosedp/mill-docker-nativeimage

Import the plugin, extend your module with `DockerNative` and configure the
parameters for your application using the `DockerNativeConfig` trait in the
`dockerNative` object.

[source,scala]
----
//| mvnDeps: ["com.carlosedp::mill-docker-nativeimage::0.6.0"]

import mill.*, mill.scalalib.*, mill.scalalib.scalafmt.*
import com.carlosedp.milldockernative.DockerNative

object hello extends ScalaModule, DockerNative {
  def scalaVersion = "3.3.0"
  object dockerNative extends DockerNativeConfig {
    // Native Image parameters
    def nativeImageName         = "hello"
    def nativeImageGraalVmJvmId = Task {"graalvm-java17:22.3.2"}
    def nativeImageClassPath    = runClasspath()
    def nativeImageMainClass    = "com.domain.Hello.Hello"
    // GraalVM parameters depending on your application needs
    def nativeImageOptions = Seq(
      "--no-fallback",
      "--enable-url-protocols=http,https",
      "-Djdk.http.auth.tunneling.disabledSchemes=",
    ) ++ (if (sys.props.get("os.name").contains("Linux")) Seq("--static") else Seq.empty)

    // Generated Docker image parameters
    def baseImage    = "ubuntu:22.04"
    def tags         = List("docker.io/myuser/helloapp")
    def exposedPorts = Seq(8080)
  }
}
----

[source,console]
----
> ./mill hello.dockerNative.build()
> # Test run
> docker run -it --rm docker.io/myuser/helloapp

> # Push to a registry
> ./mill hello.dockerNative.push
----

For more details and configuration options, please refer to the project readme
and also check the provided example code.

== Docusaurus 2

Simple Docusaurus runner for Mill

The plugin provides a mill module that allows to build the project web site using https://docusaurus.io/[Docusaurus 2] as a static content generator.

Project home. https://github.com/atooni/mill-docusaurus2


== Ensime

Create an http://ensime.github.io/[.ensime] file for your build.

Project home: https://github.com/davoclavo/mill-ensime


[source,scala]
----
//| mvnDeps: ["com.github.yyadavalli::mill-ensime:0.0.2"]
//| repositories: ["https://jitpack.io"]
----

You can then run the following to generate the `.ensime` file

[source,console]
----
> mill fun.valycorp.mill.GenEnsime/ensimeConfig
----

Optionally, you can specify the ensime server version using the –server flag like

[source,console]
----
> mill fun.valycorp.mill.GenEnsime/ensimeConfig --server "3.0.0-SNAPSHOT"
----

== Explicit Deps

A plugin that checks that `mvnDeps` and `mvnCompileDeps` accurately reflect the direct dependencies of your source code.

Project home: https://github.com/kierendavies/mill-explicit-deps


.`build.mill`
[source,scala]
----
//| mvnDeps: ["io.github.kierendavies::mill-explicit-deps::0.1.0"]

import io.github.kierendavies.mill.explicitdeps.ExplicitDepsModule

object foo extends ScalaModule, ExplicitDepsModule {
    // ...
}
----

[source,console]
----
> mill foo.checkExplicitDeps
[37/37] main.checkExplicitDeps
Found undeclared dependencies: (add these to mvnDeps)
    mvn"org.typelevel::cats-kernel:2.7.0",

Found unimported dependencies: (remove these from mvnDeps)
    mvn"org.typelevel::cats-effect:3.3.6",

main.checkExplicitDeps Found 1 undeclared dependencies, 1 unimported dependencies
----

== Fish Completion

Limited fish completion support.

Project home: https://github.com/ckipp01/mill-fish-completions

== Giter8

A plugin to test the generation of your
http://www.foundweekends.org/giter8/index.html[Giter8] template and expected
working targets for your template after generation.

Project home: https://github.com/ckipp01/mill-giter8


.`build.mill`
[source,scala]
----
//| mvnDeps: ["io.chris-kipp::mill-giter8::0.2.0"]

import io.kipp.mill.giter8.G8Module

object g8 extends G8Module {
  override def validationTargets =
    Seq("example.compile", "example.fix", "example.reformat")
}
----

The most common task you'd then use is `mill g8.validate`.

== Git

A git version plugin for mill.

Project home: https://github.com/joan38/mill-git

._build.mill_:
[source,scala]
----
//| mvnDeps: ["com.goyeau::mill-git:<latest version>"]

import com.goyeau.mill.git.GitVersionedPublishModule
import mill.scalalib.JavaModule
import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}

object `jvm-project` extends JavaModule, GitVersionedPublishModule {
  override def pomSettings = PomSettings(
    description = "JVM Project",
    organization = "com.goyeau",
    url = "https://github.com/joan38/mill-git",
    licenses = Seq(License.MIT),
    versionControl = VersionControl.github("joan38", "mill-git"),
    developers = Seq(Developer("joan38", "Joan Goyeau", "https://github.com/joan38"))
  )
}
----

[source,console]
----
> mill show jvm-project.publishVersion
[1/1] show
[2/2] com.goyeau.mill.git.GitVersionModule.version
"0.0.0-470-6d0b3d9"
----

== GitHub Dependency Graph Submission

A plugin to submit your mill dependency graph to GitHub through their
https://github.blog/2022-06-17-creating-comprehensive-dependency-graph-build-time-detection/[Dependency
Submission API].

Project home: https://github.com/ckipp01/mill-github-dependency-graph


The easiest way to use this plugin is with the
https://github.com/ckipp01/mill-github-dependency-graph[mill-dependency-submission]
action. You can add it as a workflow:

[source,yaml]
----
name: github-dependency-graph

on:
  push:
    branches:
      - main

jobs:
  submit-dependency-graph:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: coursier/cache-action@v6
    - uses: actions/setup-java@v3
      with:
        distribution: 'temurin'
        java-version: '17'
    - uses: ckipp01/mill-dependency-submission@v1
----


== Header

`header` is a plugin that allows you to automate adding headers to the top
of the files in your projects. It also has an ability to check that all files
have a certain header in place. The plugin was inspired by and is similar to
sbt-header.

Project home: https://github.com/lewisjkl/header


== Hepek

`mill-hepek` is a plugin for writing Scala ``object``s to files.

It is used as a core for Hepek static site generator: https://sake92.github.io/hepek/hepek/index.html .

Project home: https://github.com/sake92/mill-hepek


== Integration Testing Mill Plugins

Integration testing for mill plugins against older Mill versions (0.6.x - 0.11.x).

Project home: https://github.com/lefou/mill-integrationtest

We assume, you have a mill plugin named `mill-demo`

.`build.mill`
[source,scala]
----
import mill.*, mill.scalalib.*

object demo extends ScalaModule, PublishModule {
  // ...
}
----

Add a new test sub-project, e.g. `itest`.

.`build.mill`
[source,scala]
----
//| mvnDeps: ["de.tototec::de.tobiasroeser.mill.integrationtest_mill0.9:0.4.0"]

import de.tobiasroeser.mill.integrationtest.*

object demo extends ScalaModule, PublishModule {
  // ...
}

object itest extends MillIntegrationTestModule {

  def millTestVersion = "0.9.3"

  def pluginsUnderTest = Seq(demo)

}
----

Your project should now look similar to this:

[source,text]
----
.
+-- demo/
|   +-- src/
|
+-- it/
    +-- src/
        +-- 01-first-test/
        |   +-- build.mill
        |   +-- src/
        |
        +-- 02-second-test/
            +-- build.mill
----

As the buildfiles `build.mill` in your test cases typically want to access the locally built plugin(s),
the plugins publishes all plugins referenced under `pluginsUnderTest` to a temporary ivy repository, just before the test is executed.
The mill version used in the integration test then used that temporary ivy repository.

Instead of referring to your plugin with `//| mvnDeps.&#39;your::plugin:version&#39;`,
you can use the following line instead, which ensures you will use the correct locally build plugins.

Effectively, at execution time, this line gets replaced by the content of `plugins.sc`, a file which was generated just before the test started to execute.

Please always refer to the https://github.com/lefou/mill-integrationtest[official plugin documentation site] for complete and up-to-date information.

== JaCoCo - Code Coverage

Mill plugin to collect test coverage data with https://www.jacoco.org/jacoco/[JaCoCo] and generate reports.

Plugin home: https://github.com/lefou/mill-jacoco



== JBake

Create static sites/blogs with JBake.

Plugin home: https://github.com/lefou/mill-jbake

JBake home: https://jbake.org


.`build.mill`
[source,scala]
----
//| mvnDeps: ["de.tototec::de.tobiasroeser.mill.jbake:0.1.0"]

import mill.*
import de.tobiasroeser.mill.jbake.*

object site extends JBakeModule {
  def jbakeVersion = "2.6.4"
}
----

Generate the site:

[source,console]
----
> mill site.jbake
----

Start a local Web-Server on Port 8820 with the generated site:

[source,console]
----
> mill site.jbakeServe
----


== JBuildInfo

This is a Mill module similar to
xref:contrib/buildinfo.adoc[BuildInfo]
but for Java.
It will generate a Java class containing information from your build.

Project home: https://github.com/carueda/mill-jbuildinfo

To declare a module that uses this plugin, extend the
`com.github.carueda.mill.JBuildInfo` trait and provide
the desired information via the `buildInfoMembers` method:

.`build.mill`
[source,scala]
----
//| mvnDeps: ["com.github.carueda::jbuildinfo:0.1.2"]

import com.github.carueda.mill.JBuildInfo
import mill.T

object project extends JBuildInfo {
  def buildInfoMembers: T[Map[String, String]] = Task {
    Map(
      "name" -> "some name",
      "version" -> "x.y.z"
    )
  }
}
----

This will generate:

.`BuildInfo.java`
[source,java]
----
public class BuildInfo {
  public static final String getName() { return "some name"; }
  public static final String getVersion() { return "x.y.z"; }
}
----


* `def buildInfoMembers: T[Map[String, String]]`

The map containing all member names and values for the generated class.

* `def buildInfoClassName: String`, default: `BuildInfo`

The name of the class that will contain all the members from
`buildInfoMembers`.

* `def buildInfoPackageName: Option[String]`, default: `None`

The package name for the generated class.


== Kotlin

https://kotlinlang.org/[Kotlin] compiler support for mill.

Project home: https://github.com/lefou/mill-kotlin

This project has been moved into the Mill repository since Mill 0.12.


== MDoc

Simple MDoc runner for Mill

This plugin provides a mill module that allows to execute https://scalameta.org/mdoc/[Scala MDoc] from within a mill build.
Scala MDoc simply compiles properly marked Scala snippets in plain md files and optionally runs them through an interpreter, augmenting the code with the interpreter output.

Project home: https://github.com/atooni/mill-mdoc


== `millw` / `millw.bat` - Mill Wrapper Scripts

Small script to automatically fetch and execute mill build tool.

Project home: https://github.com/lefou/millw

This project has been moved into the Mill repository with Mill 0.13 / 1.0


== MiMa

Check binary compatibility with mill.

Project home: https://github.com/lolgab/mill-mima


Just mix-in the `Mima` trait into your `ScalaModule`.
And set the previous artifacts you want to check binary compatibility.

[source,scala]
----
//| mvnDeps: ["com.github.lolgab::mill-mima_mill0.9:0.0.2"]

import mill.*, scalalib.*
import com.github.lolgab.mill.mima.*

object main extends ScalaModule, Mima {

  def mimaPreviousArtifacts = Seq(
    mvn"my_group_id::main:my_previous_version"
  )

  // other settings ...

}
----

You can then check the binary compatibility of the module with:

[source,console]
----
> mill main.mimaReportBinaryIssues
Binary compatibility check passed.
----


== Missinglink

https://github.com/spotify/missinglink[missinglink] check for Mill, ported from https://github.com/scalacenter/sbt-missinglink[sbt-missinglink].

Project home: https://github.com/hoangmaihuy/mill-missinglink

_build.mill_:
[source,scala]
----
//| mvnDeps: ["io.github.hoangmaihuy::mill-missinglink::<latest-version>"]

import io.github.hoangmaihuy.missinglink.*

object example extends MissinglinkCheckModule
----

Runtime missinglink check command

[source,console]
----
> mill example.missinglinkCheck
----


== Native-Image

Build GraalVM Native-Image binaries with mill.

Project home: https://github.com/alexarchambault/mill-native-image

Import the plugin and add the `NativeImage` trait to your module and set some
configuration options:

[source,scala]
----
//| mvnDeps: ["io.github.alexarchambault.mill::mill-native-image::0.1.25"]

import io.github.alexarchambault.millnativeimage.NativeImage

object hello extends ScalaModule, NativeImage {
  def scalaVersion = "3.3.0"
  def mvnDeps = ... // Your deps here

  def nativeImageName         = "hello"
  def nativeImageMainClass    = "Main"
  def nativeImageGraalVmJvmId = "graalvm-java17:22.3.2"
  def nativeImageClassPath    = runClasspath()
  def nativeImageOptions = Seq(
    "--no-fallback",
    "--enable-url-protocols=http,https",
    "-Djdk.http.auth.tunneling.disabledSchemes=",
  ) ++ (if (sys.props.get("os.name").contains("Linux")) Seq("--static") else Seq.empty)
}
----

Then run the `nativeImage` task to build the native-image binary.

[source,console]
----
> ./mill hello.nativeImage
...
------------------------------------------------------------------------------------------------------------------------
                        5.9s (4.9% of total time) in 32 GCs | Peak RSS: 5.71GB | CPU load: 5.84
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /Users/myuser/repos/scala/mill-native-image/example/out/hello/nativeImage.dest/hello (executable
)
 /Users/myuser/repos/scala/mill-native-image/example/out/hello/nativeImage.dest/hello.build_artifacts.txt (txt)
========================================================================================================================
Finished generating 'hello' in 2m 0s.
----

For more configuration options, building binaries inside Docker, a sample project
and more, check the project readme.

== OpenApi

Mill plugin for generating source files from an OpenApi spec.

Project home: https://github.com/mikybars/openapi-generator-mill-plugin

.`build.mill`
[,scala]
----
//| mvnDeps: ["io.github.mikybars::openapi-generator-mill-plugin::0.1.0"]
package build

import mill.*, scalalib.*
import mill.api.BuildCtx

import io.github.mikybars.mill.openapi.OpenApiModule

object foo extends JavaModule, OpenApiModule {

  object openapi extends OpenApiConfig {
     def inputSpec = Task.Source(BuildCtx.workspaceRoot / "api/rest/v1/openapi.yml")
    def apiPackage: T[String] = "com.example.foo.rest.api"
    def modelPackage: T[String] = "com.example.foo.rest.model"
    def generatorName: T[String] = "spring"
    def modelNameSuffix: T[String] = "Dto"
    def additionalProperties: T[Map[String, String]] = Map(
      // ...
      "useSpringBoot3" -> "true",
      // ...
    )
  }

}
----

.Generate source files
[,console]
----
$ ./mill foo.openapi.generate
----


== OpenApi4s

Mill plugin for OpenApi4s generators.

Project home: https://github.com/sake92/mill-openapi4s

[source,scala]
----
//| mvnDeps: ["ba.sake::mill-openapi4s::0.7.0"]

import mill.*
import mill.scalalib.*
import ba.sake.mill.openapi4s.OpenApiGeneratorModule

object app extends ScalaModule, OpenApiGeneratorModule {
  def openApi4sPackage = "com.example.api"
  def openApi4sVersion = "0.6.1"
  // def openApi4sGenerator = "sharaf" // or "http4s"
----

.Generate source files
[source,console]
----
$ ./mill app.openApi4sGenerate
----


== OSGi

Produce OSGi Bundles with mill.

Project home: https://github.com/lefou/mill-osgi


[source,scala]
----
//| mvnDeps: ["de.tototec::de.tobiasroeser.mill.osgi:0.0.5"]

import mill.*, mill.scalalib.*
import de.tobiasroeser.mill.osgi.*

object project extends ScalaModule, OsgiBundleModule {

  def bundleSymbolicName = "com.example.project"

  def osgiHeaders = Task { super.osgiHeaders().copy(
    `Export-Package`   = Seq("com.example.api"),
    `Bundle-Activator` = Some("com.example.internal.Activator")
  )}

  // other settings ...

}
----

== PowerShell Completion

Basic PowerShell completion support.

Project home: https://github.com/sake92/mill-powershell-completion


== PublishM2

_Since Mill `0.6.1-27-f265a4` there is a built-in `publishM2Local` task in `PublishModule`._

Mill plugin to publish artifacts into a local Maven repository.

Project home: https://github.com/lefou/mill-publishM2


== Rust JNI

A plugin for build Rust JNI code! 

Project home: https://github.com/otavia-projects/mill-rust-jni

For documentation please visit the https://github.com/otavia-projects/mill-rust-jni[mill-rust-jni project page].


== ScalablyTyped

https://scalablytyped.org/[Scalablytyped] support for mill.

Project home: https://github.com/lolgab/mill-scalablytyped

Mix-in the `ScalablyTyped` trait into your `ScalaJSModule` and
set-up a `package.json` file with your TypeScript dependencies.

[source,scala]
----
//| mvnDeps: ["com.github.lolgab::mill-scalablytyped::0.0.2"]

import mill.*, scalalib.*
import com.github.lolgab.mill.scalablytyped.*

object main extends ScalaJSModule, ScalablyTyped {
  // other settings ...
}
----

It will run ScalablyTyped and add the converted dependencies to the module's `mvnDeps`.


== Scala TSI

https://github.com/scala-tsi/scala-tsi[scala-tsi] support for Mill

Project home: https://github.com/hoangmaihuy/mill-scala-tsi

_build.mill_:

[source,scala]
----
//| mvnDeps: ["io.github.hoangmaihuy::mill-scala-tsi::<latest-version>"]

import io.github.hoangmaihuy.scalatsi.*

object example extends ScalaModule, ScalaTsiModule {
// The classes that you want to generate typescript interfaces for
override def typescriptExports = Seq("MyClass")
// The output file which will contain the typescript interfaces
override def typescriptOutputFile = millSourcePath / "model.ts"
// Include the package(s) of the classes here
// Optionally import your own TSType implicits to override default default generated
override def typescriptGenerationImports = Seq("mymodel._", "MyTypescript._")
}
----

_MyClass.scala_:
[source,scala]
----
case class MyClass(foo: String, bar: Int)
----

Generate Typescript command:

[source,console]
----
> mill example.generateTypescript
----

_model.ts_:
[source]
----
export interface IMyClass {
  foo: string
  bar: number
}
----


== Scalafix

https://scalacenter.github.io/scalafix/[Scalafix] support for mill.

Project home: https://github.com/joan38/mill-scalafix

_build.mill_:

[source,scala]
----
//| mvnDeps: ["com.goyeau::mill-scalafix:<latest version>"]
import com.goyeau.mill.scalafix.ScalafixModule
import mill.scalalib.*

object project extends ScalaModule, ScalafixModule {
  def scalaVersion = "2.12.11"
}
----

[source,console]
----
> mill project.fix
[29/29] project.fix
/project/project/src/MyClass.scala:12:11: error: [DisableSyntax.var] mutable state should be avoided
  private var hashLength = 7
          ^^^
project.fix A Scalafix linter error was reported
----


== SCIP (SCIP Code Intelligence Protocol)

Support for generating https://about.sourcegraph.com/blog/announcing-scip[SCIP]
indexes from your Mill build. This is most commonly used to power intelligent
code navigation on https://sourcegraph.com/[Sourcegraph].

Project home: https://github.com/ckipp01/mill-scip

The recommended way to use `mill-scip` is via the
https://sourcegraph.github.io/scip-java/[`scip-java`] cli tool that can be
installed via https://get-coursier.io/[Coursier].

[source,console]
----
> cs install scip-java
----

Once you have `scip-java` installed the following command and the root of your
Mill build will generate an index and place it at the root of your project.

[source,console]
----
> scip-java index
----

You can also manually trigger this with Mill by doing the following:

[source, shell script, subs="attributes,verbatim"]
----

mill --import mvn:io.chris-kipp::mill-scip::{mill-scip-version} io.kipp.mill.scip.Scip/generate
----

This will then generate your `index.scip` inside of
`out/io/kipp/mill/scip/Scip/generate.dest/`.


== Shell Completions

As Mill is a tool often used from the CLI (Command line interface), you may be also interested in installing some completion support for your preferred shell:

* <<_bash_completion>>
* <<_fish_completion>>
* <<_zsh_completion>>


== Spring Boot

Support packaging Spring Boot Applications with Mill.

Project home: https://github.com/lefou/mill-spring-boot

[source,scala,subs="attributes,verbatim"]
----
import mill.*
import mill.scalalib.*
import de.tobiasroeser.mill.spring.boot.SpringBootModule

object app extends MavenModule, SpringBootModule {
  override def springBootToolsVersion = "2.7.13"
}
----

[source,console]
----
# Package as executable Spring-Boot Application
$ mill app.springBootAssembly
----


== Squery

Source code generator for https://github.com/sake92/squery/[Squery] SQL library boilerplate.

Project home: https://github.com/sake92/mill-squery

[source,scala,subs="attributes,verbatim"]
----
//| mvnDeps: ["ba.sake::mill-squery-generator::0.10.0"]

import mill.*
import mill.scalalib.*
import ba.sake.mill.squery.generator.SqueryGeneratorModule

object app extends ScalaModule, SqueryGeneratorModule {
  // use Task.Input(Task.ctx.env("MY_ENV_VAR")) to set sensitive variables like password etc
  def squeryJdbcUrl = jdbcUrl()
  def squerySchemaMappings = Seq("PUBLIC" -> "com.mypackage.myschema")
  def squeryJdbcDeps = Seq(mvn"com.h2database:h2:..")
----

.Generate source files
[source,console]
----
$ ./mill app.squeryGenerate
----


== Universal Packager

Support universal archive packaging for Java application with Mill, ported from sbt-native-packager.

Project home: https://github.com/hoangmaihuy/mill-universal-packager

.`build.mill`
[source,scala,subs="attributes,verbatim"]
----
//| mvnDeps: ["io.github.hoangmaihuy::mill-universal-packager::<latest-version>"]

import io.github.hoangmaihuy.mill.packager.archetypes.JavaAppPackagingModule

object example extends JavaAppPackagingModule {
  override def packageVersion = "0.1.0"
}
----

.Package as zip archive with Bash start script
[source,console]
----
> mill example.universalPackage
----


== VCS Version

Mill plugin to derive a version from (last) git tag and edit state. It may support other VCS as well.

Project home: https://github.com/lefou/mill-vcs-version

Lots of formatting options are provided.
When used with its defaults, the outcome is identical to the version scheme that Mill itself uses.

[source,scala]
----
//| mvnDeps: ["de.tototec::de.tobiasroeser.mill.vcs.version::0.1.2"]

import mill.*
import mill.scalalib.*
import de.tobiasroeser.mill.vcs.version.VcsVersion

object main extends JavaModule, PublishModule {
  override def publishVersion: T[String] = VcsVersion.vcsState().format()
}
----


== Zsh Completion

Limited zsh completion support.

This plugin adds ZSH shell completions to Mill.

Project home: https://github.com/carlosedp/mill-zsh-completions
