EnvFile
EnvFile copied to clipboard
EnvFile does not work with normal Application run configs when "Build and run using" ist set to "Gradle"
EnvFile works with
- Application run configurations when not delegating to Gradle
- Gradle run configurations (with experimental set to true)
However, when normal Application run configs are used in conjunction with delegated Gradle actions, the EnvFile plugin will not work. After investigating the issue, I believe this is because the userData set on the ApplicationConfiguration object is not propagated to the GradleRunConfiguration generated by IntelliJ.
Steps to reproduce:
- Open a minimal runnable gradle project in IntelliJ 2019.3
- Create an Application run configuration and configure an EnvFile for that config
- Disable delegated builds (Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Build and run Using: IntelliJ IDEA)
- Run the config with delegated builds disabled. The env file will be loaded
- Turn on delegated builds (Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Build and run Using: Gradle)
- Run the config with delegated builds enabled. The env file will not be loaded, despite the EnvFile tab being usable in the configuration window
I created a post on the IDEA Plugins forum with more details and will update this issue as I learn more information: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360007941620-UserData-and-GradleApplicationEnvironmentProvider
What version of intellij? I missed then EnvFile in my run config this morning but saw that Intellij had upgraded to 2020.1. After downgrading to 2019.3, it worked again.
I encountered this issue using both 2019.3 and 2020.1. @markuskruse the issue you're seeing is #100 and should be fixed in 3.2.1. I elaborated the description to be a bit more informational
@pilzm thanks for the PR! I merged it and will do a bit more testing before releasing a new version to see how stable it is. I will keep this issue open until then. I assume you can unblock yourself by building a version of the plugin manually and using it in your environment.
@ashald Did you release this MR?
@ashald I'm getting into this issue with 2020.1 and EnvFile 3.2.1
I am using IDEA 200.2 and envFile 3.2.1, but the problem is not solved.
Same here. Original solution with disabling delegated build works though.
I have the same issue. Switching from Build and Run Via: Gradle to Intellij fixes it.
I'm also getting this issue with IntelliJ CE 2021.1.1 and EnvFile 3.2.1. When running Gradle build my env variables are picked up, but they're not with Gradle run 😕