Warn user about incompatible Java / Scala versions
Questions about compile errors which are the result of a combination of a too new Java version and a too old Scala version come regularily in the chat and issues. We could maintain a simple matrix for minimal required Scala versions per Java version and log a warning or add an additional message if the compilation fails, to guide the user.
The comfigured Scala version {version} is known to be not compatible to JVM {version}.
Please update to at least Scala {version} by overriding:
def scalaVersion = "{version}"
Hi @lefou, This is my first attempt at contributing, so please excuse me if my questions seem trivial.
-
For defining the compatible versions matrix, can i rely on Scala JDK compatibility docs or is there any other resource that we are expected to refer to?
-
Can this problem be addressed by introducing a check task in the build.sc file that runs before the compile task?
Thanks in advance !
Hi @saitejaswinisamala, welcome to Mill.
- For defining the compatible versions matrix, can i rely on Scala JDK compatibility docs or is there any other resource that we are expected to refer to?
I think it's a good start. We can deviate if needed. Ideally you add a link to that page into a comment, so later maintainer have the origin source at hand.
- Can this problem be addressed by introducing a check task in the build.sc file that runs before the compile task?
A check task would be nice since it allows user some customization. To be helpful, the warning is show close to a potential compilation error, which we can't guarantee if it's a separate task though. You could let this task return some message, which you also append to any potentially error message from the compile task.