Skip to content
Search

Mill

lastmod 2024-11-06created 2024-11-062 edits

Mill is a fast JVM build tool that supports Java and Scala. 2-4x faster than Gradle and 5-10x faster than Maven for common workflows, Mill aims to make your project’s build process performant, maintainable, and flexible.

A fast JVM build tool for Java and Scala.

Features

  • A fast, scalable multi-language build tool supporting Java, Scala, and Kotlin
  • JVM build tools are often seen as slow and confusing, but Mill aims to make the most of the JVM's performance and usability
  • Can build the same Java codebase 5-10x faster than Maven and 2-4x faster than Gradle
  • Keeps builds clean and easy to understand with a typed config language and an immutable task graph
  • Scales well from small single-module projects to large monorepos with hundreds of modules

Pros of Mill

  • Performance: Mill's build graph automatically caches and parallelizes build tasks, keeping workflows fast and responsive. It adds minimal overhead to the logic needed to build the project, and provides tools to identify and resolve bottlenecks in the build
  • Maintainability: Configuration and custom logic are written in concise, type-checked code beyond YAML and Bash, using an immutable module tree and task graph. This catches configuration problems early and helps IDEs (IntelliJ or VSCode) understand Mill builds better than other build systems
  • Flexibility: Mill's tasks and modules allow anything from adding a simple build step to an entire language toolchain. You can pull any JVM library into your build, use Mill's rich ecosystem of third-party Mill plugins, or write your own plugins and publish them to Maven Central for others to use

Mill vs other build tools

  • Mill borrows ideas from other tools such as Maven, Gradle, and Bazel, but tries to learn from each tool's strengths and improve on its weaknesses
  • Mill vs Maven
    • Mill follows Maven's innovation of providing good defaults
      • Mill's built-in JavaModule follows Maven's "convention over configuration" style, so small Mill projects need minimal effort to get started, and larger Mill projects have a consistent structure built on these defaults
    • Mill automatically caches and parallelizes builds, giving a 3-10x speedup
      • This applies not only to the built-in tasks shipped with Mill but also to custom tasks and modules. It maximizes the agility of command-line build workflows to help maintain productivity, which matters especially in larger codebases where builds tend to slow down. Where Maven's "clean install" workflow can take over a minute, Mill may take only a few seconds
    • Mill makes the build tool much easier to customize than Maven
      • Projects usually grow beyond compiling a single language. They need custom code generation, linting workflows, tool integration, output artifacts, or support for additional languages. Mill's extensibility and IDE experience let you do this yourself easily and safely, with type-checked code and sandboxed tasks
  • Mill vs Gradle
    • Mill follows Gradle's conciseness and extensibility
      • Instead of pages of verbose XML, every line of a Mill build is meaningful. For example, adding a dependency takes 1 line in Mill, as in Gradle, unlike the 5-line <dependency> declaration found in Maven. As with Gradle, end users can easily customize the build to their exact requirements without going through the process of writing plugins
    • Mill can be 2-3x faster than Gradle
      • Both Mill and Gradle automatically cache and parallelize builds, but Mill does so with much less fixed overhead. This means less time waiting for the build tool and more time for the things that really matter to your project
    • Mill applies best practices by default
      • Every part of a Mill build is cached and incremental by default. Every Mill task writes its output to a standard location. All inter-task dependencies are captured automatically without manual annotation. While Gradle takes considerable effort and expertise to understand a build and set it up the right way, Mill's excellent IDE experience makes builds easier to understand and its extensibility model keeps you from misconfiguring the build, so in Mill the easiest thing is usually the right thing

See also

Favorite site

author Zer0 sitemap