News for hackers. Stuff that matters.
Re:Mill: A fast JVM build tool for Java and Scala by lihaoyi on Monday October 28, 2024 @07:15AM (#41969900)
Author here! Hope you take a look at the project and find it cool. There's a lot of interesting stuff here. In particular, the Video linked on the landing page is a great intros from a Java developer point of view, and the following video is a great intro from a Build Tool Architect point of view:

* https://www.youtube.com/watch?v=UsXgCeU-ovI

While Mill is focusing on JVM for now, it is very extensible and I have a strawman demo of adding a Javascript toolchain in ~100 lines of code https://mill-build.org/mill/0.12.1/extending/new-language.ht...

For those of you who want to learn more about the design principles and architecture of Mill, and what makes it unique, you should check out the page on Design Principles which has links to videos and blog posts where I elaborate on what exactly makes Mill so different from Maven, Gradle, SBT, Bazel, and so on:

* Mill Design Principles https://mill-build.org/mill/0.12.1/depth/design-principles.h...

I've mentioned this in a few places, but the comparisons with other build tools are best-effort. I have no doubt they can be made more accurate, and welcome feedback so I can go back and refine them. Please take them with a grain of salt

I'm also trying to get the community involved, so it's not just me writing code and running the show. To that end, I have set up a bounty program, so pay out significant sums of money (500-2000USD a piece) for people who make non-trivial contributions. It's already paid out about 10kUSD and has another 20kUSD on the table, so if anyone wants to get involved and make a little cash, feel free to take a shot at one of the bounties! https://github.com/orgs/com-lihaoyi/discussions/6

Re:Mill: A fast JVM build tool for Java and Scala by philipwhiuk on Monday October 28, 2024 @07:59AM (#41970196)
The current version is 0.12.1.

What's required for v1.0?

Re:Mill: A fast JVM build tool for Java and Scala by lihaoyi on Monday October 28, 2024 @08:01AM (#41970215)
Traditionally I've labelled my OSS projects 1.0 when they've stabilized and the rate of change has greatly reduced. Right now Mill is not there yet, but maybe if at end-2025 we realize no breaking changes have been needed since end-2024, we can call it 1.0
Re:Mill: A fast JVM build tool for Java and Scala by tenaf0 on Monday October 28, 2024 @09:13AM (#41970721)
Just a tiny notice, the github page, nor the website seem to currently contain an “installation” link. The one found by google returns a ‘page not found’ for the current version.
Re:Mill: A fast JVM build tool for Java and Scala by iainmerrick on Monday October 28, 2024 @08:23AM (#41970360)
I’d be interested to read a comparison with Bazel (which you already mention as one of the influences).

For somebody looking to escape from Gradle, Bazel seems like one of the most promising alternatives, as it’s built on sane and sound fundamentals. Although in practice it has plenty of rough edges and annoyances, so maybe there are areas where Mill can do better.

Re:Mill: A fast JVM build tool for Java and Scala by jitl on Monday October 28, 2024 @09:59AM (#41971069)
How possible is it to make your tool "zero-config" by default? I see a lot of comments in this thread and elsewhere on twitter asking for essentially `go build`, `go fmt`, `go test` for Java/JVM. I think the language has quite strong convention around directory layout and file naming already, so do you think it would be possible for mill or a mill wrapper to offer the same kind of standardized zero config workflow? I think a JVM tool that gets that right - takes it as far as possible to the golang model - would have a lot of happy users.
Re:Mill: A fast JVM build tool for Java and Scala by hocuspocus on Monday October 28, 2024 @01:15PM (#41973573)
Scala CLI has replaced the default runner since Scala 3.5, so you can effectively do `scala run`, `scala fmt`, and so on. On the Java side, I believe JBang provides a very similar developer experience.

Fundamentally it's hard to reconcile both worlds though. Building non-trivial multi-module projects on the JVM is inherently complex especially when you throw in multiple build targets, multiple toolchains, multiple platforms...

With simpler build tools (like in Go or Rust) you shift this complexity elsewhere, typically in a Makefile and/or a Docker/OCI based build pipeline, and these can get pretty complex too. Let alone distributed build tools like Bazel.

- https://scala-cli.virtuslab.org

- https://www.jbang.dev

Re:Mill: A fast JVM build tool for Java and Scala by vvillena on Monday October 28, 2024 @01:19PM (#41973619)
There's scala-cli, which has become the default Scala run command since Scala 3.5 but is also available separately. It has all those bells and whistles and allows scripts to grow organically. And no matter the name, it handles Java code too.

With scala-cli, there's not even a need to download a Java runtime or a language distribution. You can let the runner do its thing, or pass options to choose the JVM and the language version to use, or even write those options into special headers in the code files. You can also write tests, format code... it's all built-in. And in cases the code outgrows the tool and there's a need to migrate to a different build tool, there's even a feature to export the build to Sbt or Mill.

Re:Mill: A fast JVM build tool for Java and Scala by kelnos on Monday October 28, 2024 @09:31PM (#41978473)
Not the author, but this is unfortunately a bit more difficult than it sounds. Like for example, where do you get the name of the jar file to build? I guess you could use the name of the root directory, but that may not be ideal.

How do you figure out dependencies? Import statements in .java files give you the packages to import, but those package names could be provided by one or more .jar files and, regardless, the package names need not bear any relation to the jar name or its group/artifact IDs (if pulling from e.g. a maven-style repository, which basically everyone does).

For multi-module projects, how do you figure out the dependencies between the modules, even? Sure, you could probably figure that out by parsing all the .java files in all modules and figuring out what they provide and import, but that would be slower than maven, probably.

You could certainly do this for small, dependency-free programs, but it would be such a niche use case that I don't think it would be worth the time.

Re:Mill: A fast JVM build tool for Java and Scala by jitl on Tuesday October 29, 2024 @09:17AM (#41983553)
Name of the jar? `java build jar/foo` -> foo.jar, `java build src/dog` -> dog.jar.

Dependencies? It's okay to use a dependency list file for these - I guess I don't consider this config compared to the stuff I usually find in a Gradle or Maven file. The thing I'm alergic to is all the stuff that isn't a dependency list.

In Go, these go in a go.module file that's automatically updated by the build tooling, which runs instantly & has a cache you never need to think about. Go has the advantage of import paths being URLs that specify the dependency too, but I think my Go-For-Java tool would use reverse package import search from an online service to map eg com.foo.bar.something.Potato to the appropriate package "foo-bar" from Maven Central or whatever. Building that index seems like a trivial program to write for the average Java engineer.

The more I think about this "go for java" idea, the more I want to build it "in anger" just to see how off-base I am. Maybe I really am just going to re-implement or wrap sbt, mill, gradle, https://www.jbang.dev/ idk. It just feels like the experience could be an order of magnitude simpler as an end-user with some conventions strictly enforced by the tooling.

Re:Mill: A fast JVM build tool for Java and Scala by hocuspocus on Tuesday October 29, 2024 @12:49PM (#41986403)
There are initiatives like declarative Gradle or JetBrains' Amper. But I assume they'll hit a wall in real-life exactly like Maven does. Think about packaging for instance, I see at least 4 or 5 different ways that are fairly common, and that's for one target only.
Re:Mill: A fast JVM build tool for Java and Scala by Axnyff on Monday October 28, 2024 @10:07AM (#41971140)
Hi, it looks pretty interesting! There's a broken link in the homepage though, Mill vs sbt links to the gradle page

Good luck for your project!

Re:Mill: A fast JVM build tool for Java and Scala by wiradikusuma on Monday October 28, 2024 @11:26AM (#41972021)
Does it support Quarkus (esp. native build)?
Re:Mill: A fast JVM build tool for Java and Scala by hocuspocus on Monday October 28, 2024 @12:53PM (#41973328)
Re:Mill: A fast JVM build tool for Java and Scala by lihaoyi on Monday October 28, 2024 @08:21PM (#41978080)
It should! I haven't had a chance to create an example myself yet, but there's a 500USD bounty open if anyone wants to take a crack at it https://github.com/com-lihaoyi/mill/issues/3549
Re:Mill: A fast JVM build tool for Java and Scala by layer8 on Monday October 28, 2024 @04:56PM (#41976197)
I couldn’t quickly find how dependency resolution and versioning works in Mill. Can you give any pointers?

Also, what’s with the “ivy” on https://mill-build.org/mill/0.12.1/comparisons/maven.html ? Any relation to Apache Ivy?

Re:Mill: A fast JVM build tool for Java and Scala by lihaoyi on Monday October 28, 2024 @05:10PM (#41976335)
Dependency resolution uses Coursier, which is one of the open source JVM dependency resolvers. SBT uses it too, and my last company used it with Bazel

The "ivy" thing is legacy haha. Mill used to use Apache Ivy to resolve dependencies, years ago. Coursier was a better/faster replacement, but names have a tendency to stick around