mbonnin
05/25/2022, 4:57 PMephemient
05/25/2022, 5:01 PMdirenv
support in general)mcpiroman
05/25/2022, 5:02 PMmbonnin
05/25/2022, 5:02 PMIt would be great if IntelliJ picks up the JAVA SDK based on JAVA_HOME set by jenv (or similar other tool).This part is working already right?
mbonnin
05/25/2022, 5:03 PMephemient
05/25/2022, 5:03 PMephemient
05/25/2022, 5:04 PMmbonnin
05/25/2022, 5:06 PMmcpiroman
05/25/2022, 5:06 PMmbonnin
05/25/2022, 5:06 PMmbonnin
05/25/2022, 5:07 PMmcpiroman
05/25/2022, 5:08 PMmbonnin
05/25/2022, 5:08 PMFleshgrinder
05/25/2022, 5:09 PM.java-version
file in the root and our Gradle reads this to set up the project's target JVM. With this it is possible to also configure IntelliJ by manipulating some XML files in the .idea
directory. More specifically the .idea/misc.xml
(example for 11):
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
And in `.idea/gradle.xml`:
<option name="delegatedBuild" value="true" />
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
I think we also write .idea/compiler.xml
but that is not really required since we delegate everything to Gradle anyways:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>
I might have forgotten one of the steps we perform, but I think that's it.
Would be great if IntelliJ can spare us this and just do it on its own. πmbonnin
05/25/2022, 5:10 PMFleshgrinder
05/25/2022, 5:10 PMmbonnin
05/25/2022, 5:10 PMmbonnin
05/25/2022, 5:11 PMFleshgrinder
05/25/2022, 5:12 PMChris Lee
05/25/2022, 5:13 PMmbonnin
05/25/2022, 5:13 PMmbonnin
05/25/2022, 5:14 PMFleshgrinder
05/25/2022, 5:14 PM.java-version
contains the JDK to run Gradle with (use jEnv) and the default bytecode target. If a subprojects requires something else for whatever reason we use tool chains. This is not as flexible as some might require it in all possible situations, but it works for us at the moment and nobody needed more than that. In fact I wanted to figure out how to get rid of tool chains since 9+ can create bytecode for any previous Java release, but haven't looked into this yet.ephemient
05/25/2022, 5:15 PMFleshgrinder
05/25/2022, 5:20 PM--release
is what I was referring to in my previous comment. Switching from tool chains to --release
in our plugins would be much more efficient since no additional JDK needs to be downloaded. The reason we implemented it with tool chains was originally to ensure that it doesn't matter which JDK someone uses to run Gradle, the tests and everything still uses the correct JDK. This also works as intended, but it has the side effect of downloading tool chains in the previously mentioned J17 with J8 submodule case.Chris Lee
05/25/2022, 5:57 PM--release
is set in any case (toolchain or otherwise).