Skip to content

Conversation

@ajaychandran
Copy link
Contributor

@ajaychandran ajaychandran commented Nov 1, 2025

Follow up to #5428.

@lihaoyi
Copy link
Member

lihaoyi commented Nov 1, 2025

@ajaychandran if the heuristics to guess the java version from the compiler flags don't work well in practice, maybe we should just go with mill-java-version: system then. Trying to look at the user JAVA_HOME and expecting the user to set it to the right place is probably too error prone for new Mill users to do reliably

@ajaychandran
Copy link
Contributor Author

@ajaychandran if the heuristics to guess the java version from the compiler flags don't work well in practice, maybe we should just go with mill-java-version: system then. Trying to look at the user JAVA_HOME and expecting the user to set it to the right place is probably too error prone for new Mill users to do reliably

We auto-detect the JVM version from the system JDK in ModuleConfig.JavaHomeModule.system and set a concrete version for jvmId. The user is not required to set a version anywhere.
Only the environment needs to be set up with the correct JAVA_HOME. This should already be true on a development system.

Using mill-java-version: system will also work. The loss of build reproducibility is acceptable I suppose.

@lihaoyi
Copy link
Member

lihaoyi commented Nov 1, 2025

Got it. If we want to auto-detect the JVM version, how about just shelling out to java -version? That should give us a version to use and would be simpler than the logic you currently have in lazy val system

@ajaychandran
Copy link
Contributor Author

On second thoughts, I will make the switch to the mill-java-version: system option.
This will minimize changes to any CI workflows and is semantically more accurate.

@ajaychandran ajaychandran marked this pull request as draft November 1, 2025 16:58
@ajaychandran ajaychandran changed the title Fixed mapping for jvmId in build conversions WIP: Fix build functionality post auto-migration Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants