com-lihaoyi / mill

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
https://mill-build.org/
MIT License
2.18k stars 348 forks source link

Add ability to select Java versions on a per-module basis (1000USD bounty) #3480

Open lihaoyi opened 2 months ago

lihaoyi commented 2 months ago

From the maintainer Li Haoyi: I'm putting a 1000USD bounty on this issue, payable by bank transfer on a merged PR implementing this.


Currently Mill just uses the global Java for everything, which is not ideal: many projects have different parts that require different Java versions. e.g. Mockito has a submodule that requires Java 21 https://github.com/mockito/mockito/tree/main/subprojects/java21-test, and of course Mill itself has different parts targetting different versions (e.g. half our thirdparty tests run on 11, half run on 17). Currently we get by with separate jobs on Github Actions, but that's clunky and annoying to work with since it doesn't reproduce locally.

Ideally we should be able to specify Java versions on a per-module basis, which Mill will download and cache as necessary to run those specific modules. As JVM downloads can be expensive, it is probably worth caching things globally (probably the same place we cache the Mill assembly jar?) rather than caching them in the out/ folder of each project

Gradle has something like this (https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation), and it feels like it would be very useful for Mill as well

lefou commented 2 months ago

See prior discussions in the related issue