You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Motivation
The complexity of using a nightly version with Mill makes it discouraging for users.
We'd like nightlies to be easy to test, so that the newest compiler changes can be verified in users' projects.
This in turn could make regression reports reach the Scala 3 compiler team faster.
Currently, to use the nightly one has to
look up the explicit nightly version manually
figure out the necessary repo and JvmWorker shenenigans
probably first just pass the version and be surprised it doesn't work
the custom JvmWorker is needed to let us override repositories. If we solve #5874, then most of this boilerplate goes away with a single repositories override in the build header that can apply globally to all local and external modules, including the default JvmWorkerModule so we don't need to define our own custom one
@lihaoyi Could we also have the API to automatically refer to the latest nightly, like in the example? (rather than to have to explicitly pass the version string)
@Gedochao currently we pass all these group-artifact-version data to coursier, which I think supports a latest.release version that dynamically picks the most recent upload based on the current maven-metadata.xml file published on the package repository. Would that satisfy your needs?
@lihaoyi So users would have to know they have to include the reference to the nightly repo in the yaml header, and then pass latest.release as the Scala version.
Which would change the meaning between the latest nightly and latest stable/RC, depending on what repositories are there.
While better, IMO that's still unnecessarily complex.
The intention really was for users to not have to think about either of these things, and just get the latest nightly with a single switch.
With Scala CLI, one does not have to explicitly pass the repository, the tool can figure out that a version with the -NIGHTLY suffix, or one of the nightly aliases, will require to use https://repo.scala-lang.org.
The idea is to shorten the path to using the latest nightly down to the bare minimum, to encourage more people to test their projects with it (and raise issues early).
If necessary, I can break it down to smaller tickets (implicit detection of the need for a nightly Scala repo and latest nightly API could be separate steps).
I think solutions must not be equally accessible in Mill as in Scala CLI. Scala CLI is mainly an low entry point to Scala, so easy access to nightlies makes sense. Mill OTOH is a build tool to help users build robust software the easy way. While testing against a nightly should be a use case, there is some benefit in being a bit harder than selecting a stable version, since using dynamic versions in a build is what we in general don't recommend. If we make it less friction to go with the always latest version dynamically then choosing a stable version, it will end up being the go-to setup for users, compromizing the applicability of the built project. At least, that is what I perceive from supporting build tools users for a very long time. For example, since Scala Steward makes it so easy to bump Mill versions, some Mill plugin projects often bumped the Mill version, resulting in plugins potentially no longer working with older Mill versions. Even if I told them that they may loose compatibility, in the end the easyness of the wrong approach makes it rule over the more correct approach.
I wonder if latest.release would work with these maven-nightlies repositories? I'm not super familiar with how that stuff works in Coursier, @alexarchambault do you know?
They'd just need to set the scalaVersion and repositories on their module
But why is setting the repository explicitly necessary here? isn't it implicit, when user passes a nightly version already?
Will the failure to get the version at least mention what repository is missing?
Passing the repository explicitly is just how repositories work on the JVM I guess? Don't most build tools require you to add non-default repositories explicitly if you want to use them?
What perhaps adds to the confusion here, is that we only recently moved our nightlies to a separate repository (https://www.scala-lang.org/news/new-scala-nightlies-repo.html).
Up till very recently, they were on Maven Central, and I bet many users are still unaware of this change.
I'd argue it very much is a default for nightly builds (no other way around it), and with Mill being a Scala-centric build tool, it'd make sense to cross that distance for the user.
I think solutions must not be equally accessible in Mill as in Scala CLI. Scala CLI is mainly an low entry point to Scala, so easy access to nightlies makes sense. Mill OTOH is a build tool to help users build robust software the easy way.
As a counterpoint to this, it's a regular occurrence that people want to see how things will look like with a new feature (named tuples come to mind the most) in their actual work project and then come asking on discord or reach out via a dm with questions on how to take the newest version for a test drive. This is exactly the scenario we're interested in easing as once more people do this, interesting compilation errors from Scala code in the wild will be encountered earlier and hopefully reported earlier. The notion that by making something a bit more obscure and more difficult to use you're preventing dumb mistakes seems naive to me, people were fine with things like webpack config files for years 😆 If anything would help to prevent wrong usage, it would be probably a note in docs and a mill runtime warning informing that this configuration is NOT to be used for production purposes and it's for experimentation only.
I personally find the snippet proposed by @Gedochao very straightforward and intuitive - it's a Scala module so obviously I can switch version of the language to a nightly without much fuss. The nightly repository and the need of having the knowledge that it exists seems like an implementation detail of the language's infrastructure. Other langs encode things like this into the build tool ecosystem to remove friction. As a famous reference point - in Rust it's just cargo +nightly build or
Maybe, instead of fiddling with some dedicated version suffix, and splattered logic in various places, users could mix-in a ScalaNightly trait, which adds whatever is needed to bring a nightly into the game: repositories, find newest version, print warnings, offline support, ...
Those traits can also be added in build.mill.yaml files easily with extends: ScalaNightly
If you think 2 lines of config to use nightlies is too much, I think making using nightlies even easier is fine.
Since nightlies need to override multiple tasks, making support a trait that users can extends ScalaNightly would be the canonical way to do it, as @lefou mentioned. That would bring the 2 lines down to 1
@Gedochao@lbialy Perhaps you guys could send a PR to implement this? You can implement your trait in the build.mill of your own test project, make sure it works, then just paste the trait over to libs/scalalib/src/ and send a PR and it should just work for others. Maybe add a unit test in libs/scalalib/test/src/
@lbialy I already proposed a compromise which should be easy to use and explicit. But just to be clear about it ...
The notion that by making something a bit more obscure and more difficult to use you're preventing dumb mistakes seems naive to me
I was not arguing for making it more obscure and difficult. IMHO it is already easy and standard, but not as easy as you wished. The decision to publishing nightlies into a different repository wasn't made here and there were most likely good reasons for it.
If anything would help to prevent wrong usage, it would be probably a note in docs and a mill runtime warning informing that this configuration is NOT to be used for production purposes and it's for experimentation only.
I already said before, that in my experience, this is not going to stop maintainers from doing it, with hidden casualties downsteam. If doing something wrong is hard to recognize (only downstream users may have issues, if any) but easier to apply than the correct way, there will be some users choosing that route, since it is (on first sight) a maintenance free way to stay up to date. Understanding why it might not be a good idea costs a much higher learning/thinking effort.
Activity
lihaoyi commentedon Jan 28, 2026
the custom
JvmWorkeris needed to let us overriderepositories. If we solve #5874, then most of this boilerplate goes away with a singlerepositoriesoverride in the build header that can apply globally to all local and external modules, including the defaultJvmWorkerModuleso we don't need to define our own custom onelihaoyi commentedon Jan 29, 2026
Actually it seems like we can fix things to let
repositorieswork properly even without fiddling with global configGedochao commentedon Jan 29, 2026
@lihaoyi Could we also have the API to automatically refer to the latest nightly, like in the example? (rather than to have to explicitly pass the version string)
lihaoyi commentedon Jan 29, 2026
@Gedochao currently we pass all these group-artifact-version data to coursier, which I think supports a
latest.releaseversion that dynamically picks the most recent upload based on the currentmaven-metadata.xmlfile published on the package repository. Would that satisfy your needs?Gedochao commentedon Jan 29, 2026
@lihaoyi So users would have to know they have to include the reference to the nightly repo in the yaml header, and then pass
latest.releaseas the Scala version.Which would change the meaning between the latest nightly and latest stable/RC, depending on what repositories are there.
While better, IMO that's still unnecessarily complex.
The intention really was for users to not have to think about either of these things, and just get the latest nightly with a single switch.
With Scala CLI, one does not have to explicitly pass the repository, the tool can figure out that a version with the
-NIGHTLYsuffix, or one of thenightlyaliases, will require to use https://repo.scala-lang.org.With Scala CLI, I can
scala-cli -e 'println("Hello")' -S nightlyor
scala-cli -e 'println("Hello")' -S 3.8.3-RC1-bin-20260129-40075f7-NIGHTLYThe repository is added implicitly.
Mill could go similarly with something like:
The idea is to shorten the path to using the latest nightly down to the bare minimum, to encourage more people to test their projects with it (and raise issues early).
If necessary, I can break it down to smaller tickets (implicit detection of the need for a nightly Scala repo and latest nightly API could be separate steps).
Gedochao commentedon Jan 29, 2026
The idea behind #6630 is very similar, BTW.
Not enough people test their projects with nightlies and RCs.
Gedochao commentedon Jan 29, 2026
...should we reopen, or do I open the follow-up tickets?
Add `mill-repositories` header to customize repository config globall…
lefou commentedon Jan 29, 2026
I think solutions must not be equally accessible in Mill as in Scala CLI. Scala CLI is mainly an low entry point to Scala, so easy access to nightlies makes sense. Mill OTOH is a build tool to help users build robust software the easy way. While testing against a nightly should be a use case, there is some benefit in being a bit harder than selecting a stable version, since using dynamic versions in a build is what we in general don't recommend. If we make it less friction to go with the always latest version dynamically then choosing a stable version, it will end up being the go-to setup for users, compromizing the applicability of the built project. At least, that is what I perceive from supporting build tools users for a very long time. For example, since Scala Steward makes it so easy to bump Mill versions, some Mill plugin projects often bumped the Mill version, resulting in plugins potentially no longer working with older Mill versions. Even if I told them that they may loose compatibility, in the end the easyness of the wrong approach makes it rule over the more correct approach.
lihaoyi commentedon Jan 29, 2026
@Gedochao with #6713, the user won't need to tweak the build header. They'd just need to set the
scalaVersionandrepositorieson their moduleI wonder if
latest.releasewould work with thesemaven-nightliesrepositories? I'm not super familiar with how that stuff works in Coursier, @alexarchambault do you know?Gedochao commentedon Jan 29, 2026
But why is setting the repository explicitly necessary here? isn't it implicit, when user passes a nightly version already?
Will the failure to get the version at least mention what repository is missing?
lihaoyi commentedon Jan 29, 2026
Passing the repository explicitly is just how repositories work on the JVM I guess? Don't most build tools require you to add non-default repositories explicitly if you want to use them?
Gedochao commentedon Jan 29, 2026
What perhaps adds to the confusion here, is that we only recently moved our nightlies to a separate repository (https://www.scala-lang.org/news/new-scala-nightlies-repo.html).
Up till very recently, they were on Maven Central, and I bet many users are still unaware of this change.
I'd argue it very much is a default for nightly builds (no other way around it), and with Mill being a Scala-centric build tool, it'd make sense to cross that distance for the user.
lbialy commentedon Jan 29, 2026
As a counterpoint to this, it's a regular occurrence that people want to see how things will look like with a new feature (named tuples come to mind the most) in their actual work project and then come asking on discord or reach out via a dm with questions on how to take the newest version for a test drive. This is exactly the scenario we're interested in easing as once more people do this, interesting compilation errors from Scala code in the wild will be encountered earlier and hopefully reported earlier. The notion that by making something a bit more obscure and more difficult to use you're preventing dumb mistakes seems naive to me, people were fine with things like webpack config files for years 😆 If anything would help to prevent wrong usage, it would be probably a note in docs and a mill runtime warning informing that this configuration is NOT to be used for production purposes and it's for experimentation only.
I personally find the snippet proposed by @Gedochao very straightforward and intuitive - it's a Scala module so obviously I can switch version of the language to a nightly without much fuss. The nightly repository and the need of having the knowledge that it exists seems like an implementation detail of the language's infrastructure. Other langs encode things like this into the build tool ecosystem to remove friction. As a famous reference point - in Rust it's just
cargo +nightly buildorif you want to execute all cargo commands with a latest nightly in this project.
lefou commentedon Jan 29, 2026
Maybe, instead of fiddling with some dedicated version suffix, and splattered logic in various places, users could mix-in a
ScalaNightlytrait, which adds whatever is needed to bring a nightly into the game: repositories, find newest version, print warnings, offline support, ...Those traits can also be added in
build.mill.yamlfiles easily withextends: ScalaNightlylihaoyi commentedon Jan 29, 2026
If you think 2 lines of config to use nightlies is too much, I think making using nightlies even easier is fine.
Since nightlies need to override multiple tasks, making support a
traitthat users canextends ScalaNightlywould be the canonical way to do it, as @lefou mentioned. That would bring the 2 lines down to 1@Gedochao @lbialy Perhaps you guys could send a PR to implement this? You can implement your
traitin thebuild.millof your own test project, make sure it works, then just paste thetraitover tolibs/scalalib/src/and send a PR and it should just work for others. Maybe add a unit test inlibs/scalalib/test/src/Gedochao commentedon Jan 30, 2026
Lemme see what I can do.
@lihaoyi Can we reopen the issue? You can assign it to me.
lefou commentedon Jan 30, 2026
@lbialy I already proposed a compromise which should be easy to use and explicit. But just to be clear about it ...
I was not arguing for making it more obscure and difficult. IMHO it is already easy and standard, but not as easy as you wished. The decision to publishing nightlies into a different repository wasn't made here and there were most likely good reasons for it.
I already said before, that in my experience, this is not going to stop maintainers from doing it, with hidden casualties downsteam. If doing something wrong is hard to recognize (only downstream users may have issues, if any) but easier to apply than the correct way, there will be some users choosing that route, since it is (on first sight) a maintenance free way to stay up to date. Understanding why it might not be a good idea costs a much higher learning/thinking effort.