[tip] Elegantly supporting old Java versions specified in idiomatic version files #4467
henrebotha
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a super tiny thing but I didn't see it made explicit anywhere, and thought it was worth sharing.
When you have a project using
.java-versions
, requesting an old version of Java, you might run into this kind of error.There's any number of ways to work around this, but I think the most elegant by far is mise's aliases feature. Create a
mise.local.toml
file in your repo (if one doesn't already exist) and add an alias like this.This is the minimum necessary change in order to make everything work. You're now specifying only to mise which vendor to use, but the source of truth for which version to use is still
.java-versions
. So if for example someone else updates.java-versions
to request a different version, mise will detect and handle that. And you're only specifying the alias for this one particular version, which means an upstream change to.java-versions
to specify a particular vendor will still be honoured by mise.In short, you get to benefit from using mise, and no-one else has to, and you will still honour
.java-versions
.Beta Was this translation helpful? Give feedback.
All reactions