Skip to content

KT-84386: Support Maven Toolchains in kotlin-maven-plugin#5694

Open
kralliv wants to merge 1 commit intoJetBrains:masterfrom
kralliv:KT-84386
Open

KT-84386: Support Maven Toolchains in kotlin-maven-plugin#5694
kralliv wants to merge 1 commit intoJetBrains:masterfrom
kralliv:KT-84386

Conversation

@kralliv
Copy link
Contributor

@kralliv kralliv commented Feb 18, 2026

YouTrack: KT-84386

Adds support for Maven Toolchains in the kotlin-maven-plugin. Design is analogous to the maven-compiler-plugin.

An explicitly set jdkHome still takes precedence over a toolchain, but a toolchain will take precedence over the JAVA_HOME. I made sure, that both of these cases are reflected in the logs to simplify debugging by user. The behaviour of builds in cases where jdkHome is not set but toolchains are present might be affected by this change, though that is the goal after all.

The ugly part of this implementation is the retrieval of the JDK home path from a Toolchain. Neither Toolchain nor JavaToolchain offer any functions to query the JDK home itself, only the internal JavaToolchainImpl has a suitable function. However, as evidenced by the already deprecated DefaultJavaToolChain, it probably is unwise to depend on these internals. I therefor opted to instead query the javac executable path and traverse upwards from there. The structure of the JDK should be more reliable longterm.

@kralliv kralliv requested review from a team as code owners February 18, 2026 16:04
@kralliv kralliv requested a review from adam-enko February 18, 2026 16:04
@kotlin-safe-merge
Copy link

Code Owners

Rule Owners Approval
/​libraries/​tools/​kotlin-​maven-​plugin/​ @JetBrains/build-tools-api, @JetBrains/kotlin-build-tools

@Tapchicoma Tapchicoma self-requested a review February 18, 2026 16:45
@Tapchicoma Tapchicoma self-assigned this Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants