ashald / EnvFile

EnvFile 3.x is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.
MIT License
551 stars 129 forks source link

With "Ignore missing files" option off no visible error is shown if the file is missing, all gradle commands fail silently #235

Open valentin9 opened 4 months ago

valentin9 commented 4 months ago

Thanks for the great plugin, have been using it for a long time and never had any issues.

One thing I had just recently, where I lost a bit of time trying to figure out why nothing is working 😆 .

If I have "ignore missing files" option off no visible error is shown if the file is missing, all IDE gradle commands and other Run/Debug configurations fail silently. No popup or any window is opened, it just fails.

IntelliJ IDEA 2023.3.4 (Ultimate Edition) EnvFile@3.4.2

In the IDE logs I see:

2024-07-04 13:16:42,370 [79923954]   INFO - #c.i.e.r.ExecutionUtil - Error running 'seo:services:api:api [build]':<br>java.nio.file.NoSuchFileException: services/api/.app.env
com.intellij.execution.ExecutionException: java.nio.file.NoSuchFileException: services/api/api/.app.env
    at net.ashald.envfile.platform.EnvFileEnvironmentVariables.render(EnvFileEnvironmentVariables.java:76)
    at net.ashald.envfile.products.idea.IdeaRunConfigurationExtension.updateJavaParameters(IdeaRunConfigurationExtension.java:71)
    at com.intellij.execution.RunConfigurationExtension.updateJavaParameters(RunConfigurationExtension.java:27)
    at com.intellij.execution.JavaRunConfigurationExtensionManager.updateJavaParameters(JavaRunConfigurationExtensionManager.kt:42)
    at com.intellij.execution.ExternalSystemRunConfigurationJavaExtension.updateVMParameters(ExternalSystemRunConfigurationJavaExtension.kt:62)
    at com.intellij.openapi.externalSystem.service.execution.configuration.ExternalSystemRunConfigurationExtensionManager.updateVMParameters(ExternalSystemRunConfigurationExtensionManager.kt:24)
    at com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunnableState.getJvmParametersSetup(ExternalSystemRunnableState.java:404)
    at com.intellij.openapi.externalSystem.service.execution.ExternalSystemRunnableState.execute(ExternalSystemRunnableState.java:179)
    at com.intellij.openapi.externalSystem.service.execution.ExternalSystemTaskRunner.doExecute(ExternalSystemTaskRunner.kt:37)
    at com.intellij.openapi.externalSystem.service.execution.ExternalSystemTaskRunner.access$doExecute(ExternalSystemTaskRunner.kt:18)
    at com.intellij.openapi.externalSystem.service.execution.ExternalSystemTaskRunner$execute$1.invoke(ExternalSystemTaskRunner.kt:28)
    at com.intellij.openapi.externalSystem.service.execution.ExternalSystemTaskRunner$execute$1.invoke(ExternalSystemTaskRunner.kt:27)
    at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:215)
    at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:213)
    at com.intellij.execution.impl.ExecutionManagerImpl.doStartRunProfile$lambda$2(ExecutionManagerImpl.kt:278)
    at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
    at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:843)
    at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:463)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:75)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:67)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1436)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:82)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:124)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:44)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:695)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:589)
    at com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:44)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:72)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:355)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:354)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:793)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:354)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:349)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:848)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:391)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
Caused by: net.ashald.envfile.exceptions.InvalidEnvFileException: java.nio.file.NoSuchFileException: services/api/api/.app.env
    at net.ashald.envfile.providers.EnvFileReader$Utf8Reader.read(EnvFileReader.java:36)
    at net.ashald.envfile.providers.SingleFileEnvVarsProvider.getEnvVars(SingleFileEnvVarsProvider.java:39)
    at net.ashald.envfile.platform.EnvFileEnvironmentVariables.render(EnvFileEnvironmentVariables.java:67)
    ... 55 more
Caused by: java.nio.file.NoSuchFileException: services/api/api/.app.env
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
    at java.base/java.nio.file.Files.readAllBytes(Files.java:3288)
    at net.ashald.envfile.providers.EnvFileReader$Utf8Reader.read(EnvFileReader.java:34)
    ... 57 more
valentin9 commented 4 months ago

Ah, I see there is an IDE alert I missed. So it's not completely silent. I figured out that if I have "Display balloon notifications" off, I don't see any feedback at all. Not sure if that is intended or not or can be fixed

image