mill icon indicating copy to clipboard operation
mill copied to clipboard

Warn user about incompatible Java / Scala versions

Open lefou opened this issue 1 year ago • 2 comments

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}"

lefou avatar Jun 27 '24 07:06 lefou

Hi @lefou, This is my first attempt at contributing, so please excuse me if my questions seem trivial.

  1. 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?

  2. Can this problem be addressed by introducing a check task in the build.sc file that runs before the compile task?

Thanks in advance !

saitejaswinisamala avatar Jul 06 '24 22:07 saitejaswinisamala

Hi @saitejaswinisamala, welcome to Mill.

  1. 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.

  1. 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.

lefou avatar Jul 25 '24 09:07 lefou