Mill: A Better Build Tool for Java, Scala, & Kotlin

d Maven Central Version GitHub Repo stars

Mill is a build tool that improves upon the tools traditionally used in the JVM ecosystem:

Although the Java compiler is very fast and the Java language is easy to learn, JVM build tools have a reputation for being sluggish, complicated, and confusing. Mill tries to offer a better alternative that gives the Java platform the developer experience it deserves.

For detailed comparisons with other build tools, check out these pages:

Performance

Mill automatically caches and parallelizes build tasks and tests to keep local development fast, uses a long-lived daemon to keep the JVM warm, and shortens CI times with selective test execution. Play the video below to compare compiling the same 500,000 line Netty codebase with Mill (~11s) vs Maven (~60s)

Simplicity

Mill’s declarative build.mill.yaml files contain only the essence of what you want to configure in your build, stripping away the endless complexity in traditional JVM build tools to make your project configuration easy to write, easy to read, and easy to understand

Mill build.mill.yaml

extends: JavaModule
mvnDeps:
- org.jsoup:jsoup:1.7.2
- org.slf4j:slf4j-nop:2.0.7

Maven pom.xml

<project xmlns="..." xmlns:xsi="...">
  <modelVersion>4.0.0</modelVersion>
  <groupId>example</groupId>
  <artifactId>html-scraper</artifactId>
  <version>1.0</version>
  <dependencies>
    <dependency>
      <groupId>org.jsoup</groupId>
      <artifactId>jsoup</artifactId>
      <version>1.17.2</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-nop</artifactId>
      <version>2.0.7</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
          <mainClass>HtmlScraper</mainClass>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Builtins

Mill supports most common JVM development workflows and tools built in, so you can get very far before you need to reach for third-party plugins or write custom code to extend your build system. The example build file below shows how Mill handles many of the common settings that often need to be configured in a build tool:

extends: [JavaModule, PublishModule]

mvnDeps:
- org.thymeleaf:thymeleaf:3.1.1.RELEASE
- org.slf4j:slf4j-nop:2.0.7

repositories: [https://oss.sonatype.org/content/repositories/releases]

mainClass: foo.Foo2

jvmVersion: 11 # Pin a specific JVM version, supports >=11

# Add additional source and resource folders
sources: !append [custom-src/]
resources: !append [custom-resources/]

# Configure java compiler and runtime options and env vars
javacOptions: [-deprecation]
forkArgs: [-Dmy.custom.property=my-prop-value]
forkEnv: { MY_CUSTOM_ENV: my-env-value }

# Settings to publish to Maven Central
publishVersion: 0.0.1
artifactName: example
pomSettings:
  description: Example
  organization: com.lihaoyi
  url: https://github.com/com.lihaoyi/example
  licenses: [MIT]
  versionControl: https://github.com/com.lihaoyi/example
  developers: [{name: Li Haoyi, email: example@example.com}]

Beyond this simple example, the table below links to the relevant part of the documentation and examples for each feature or tool that Mill supports:

Mill can be used for applications built on top of common JVM frameworks like Spring Boot (both in Java and in Kotlin), Micronaut, Ktor, or Http4s. It is used in the wild to build many real-world projects, such as:

Getting Started

To get started using Mill for the first time, or migrating an existing JVM codebase (built using Maven, Gradle, or SBT) to Mill, see:

Or see the language-specific introductory documentation linked below:

Commercial Support

Commercial support and services related to Mill are available if you need help with training, adoption, or maintenance in your organization. Contact us at:

Email us with details on what you need and we can make an arrangement.

Community

To engage with the Mill community, you can use the channels below:

If you prefer a video introduction to Mill, see:

Contributing

If you want to contribute to Mill, or are interested in the fundamental ideas behind Mill rather than the user-facing features discussed above, check out the page on Mill Design Principles. In particular, this video is a must-watch to help you understand the fundamental concepts behind Mill and why they are interesting:

Mill maintains an open list of issue bounties below, with payouts ranging from 500USD to 3000USD per issue. Feel free to look through the list and try your hand at any bounties that may interest you