The environment variables do not apply to the Java application on IntelliJ IDEA 2025.02.
After updating to IntelliJ IDEA 2025.02, I still see the settings from the Env plugin, but when I run the application, it starts without the environment variables.
The configuration:
- Java 21
- Gradle 8.6
Confirming for Kotlin as well. Took me some time of debugging why my app that worked a few days ago, suddenly stopped :)
If this is of any help, on 2025.1.4.1, while it worked, the entries in idea.log looked like this:
2025-08-04 10:34:52,387 [85832314] INFO - #o.j.p.g.GradleManager - Instructing gradle to use java from /Users/jakub.g/.sdkman/candidates/java/current
2025-08-04 10:34:52,390 [85832317] INFO - #o.j.p.g.s.e.GradleExecutionHelper - Passing command-line to Gradle Tooling API: :app:classes --init-script /private/var/folders/lc/pkd18gln5nv5ftn6ft5csg240000gn/T/ijMapper1.gradle --init-script /private/var/folders/lc/pkd18gln5nv5ftn6ft5csg240000gn/T/ijresolvers1.gradle --init-script /private/var/folders/lc/pkd18gln5nv5ftn6ft5csg240000gn/T/ijJvmDebugger1.gradle --init-script /private/var/folders/lc/pkd18gln5nv5ftn6ft5csg240000gn/T/ijKotlinCoroutineJvmDebugInit1.gradle --init-script /private/var/folders/lc/pkd18gln5nv5ftn6ft5csg240000gn/T/Build_environment_check1.gradle -Didea.active=true -Didea.version=2025.1.4.1 -Didea.vendor.name=JetBrains
Now on 2025.2 they look a bit different:
2025-08-06 14:31:10,097 [ 609350] INFO - #o.j.p.g.GradleManager - Instructing gradle to use java from /Users/jakub.g/.sdkman/candidates/java/current
2025-08-06 14:31:10,562 [ 609815] INFO - #o.j.p.g.s.e.GradleExecutionHelper - Passing command-line to Gradle Tooling API: :app:redacted.envcheck.AppKt.main() --init-script /private/var/folders/lc/pkd18gln5nv5ftn6ft5csg240000gn/T/ijMapper1.gradle --init-script /private/var/folders/lc/pkd18gln5nv5ftn6ft5csg240000gn/T/ijJvmDebugger1.gradle --init-script /private/var/folders/lc/pkd18gln5nv5ftn6ft5csg240000gn/T/ijKotlinCoroutineJvmDebugInit1.gradle --init-script /private/var/folders/lc/pkd18gln5nv5ftn6ft5csg240000gn/T/addGradleAndroidTestListener1.gradle --init-script /private/var/folders/lc/pkd18gln5nv5ftn6ft5csg240000gn/T/redacted_envcheck_AppKt_main__1.gradle -Didea.active=true -Didea.version=2025.2 -Didea.vendor.name=JetBrains
So it looks like EnvFile is no longer able to inject .env values when app is run using gradle (no matter if "Enable experimental integrations - may break any time" is checked or not. It looks like it finally broke :) ).
But at least EnvFile still works when IntelliJ setting "Build, Execution -> Build Tools -> Gradle -> Build and run using" is set to "IntelliJ".
One more thing: when the app is launched via "Application" run configuration (not e.g. Kotlin) it can read .env file without any plugin like this one: https://www.jetbrains.com/help/idea/program-arguments-and-environment-variables.html#environment_variables
looks like that the intellij changed the way to instance the applications:
cmd.exe /c "..\mvnw.cmd -Didea.version=2025.2 ...
I guess that this broke the integration. It is delegating to the CMD now
I believe this is related to https://youtrack.jetbrains.com/issue/KTIJ-13874 . In my case I have a Kotlin Run Configuration. Pre-2025.2 IDEA launched it with a java command line. Now it is generating a gradle task and launching it via the gradle daemon.
We use this plugin for our Quarkus, Maven, and JUnit run configurations, and we encounter the same issue with all of them. Is there currently a plan or intention (how) to address this in a future update?
An addition of a internal IntelliJ function does not seem to be planned: https://youtrack.jetbrains.com/issue/IJPL-179804/Run-configurations-Add-ability-to-specify-a-file-that-defines-environment-variables-.env-.yml-etc.
As a heads up , with the following version:
IntelliJ IDEA 2025.2.2 Preview (Ultimate Edition)
Build #IU-252.26199.7, built on September 3, 2025
And using the classic ui plugin, i am able to use the EnvFile functionality
https://github.com/aws/aws-toolkit-jetbrains/issues/5964 looks to be the same issue, so it does not appear to be a EnvFile specific issue.