apache / apache/grails-intellij-plugin
Setting environment variables breaks Grails test run configurations
- Dominant language
- Java
- Stars
- 17
- Forks
- 4
- Avg merge
- 5d 15h
- Merged PRs (30d)
- 4
Description
### Steps to reproduce
Add an environment variable to a Grails test run configuration.
I'm running Ubuntu 18.04 with Java installed with SDKMAN!.
### Expected behaviour
Tests are executed. The environment variable is available in the application under test (with correct value).
### Actual behaviour
```
Testing started at 14:50 ...
/home//rreitzig/.sdkman/candidates/java/8.0.181-oracle/bin/java -Dgrails.home=/home//rreitzig/.sdkman/candidates/grails/2.5.6 -Dtools.jar=/home//rreitzig/.sdkman/candidates/java/8.0.181-oracle/lib/tools.jar -Dgroovy.starter.conf=/home//rreitzig/.sdkman/candidates/grails/2.5.6/conf/groovy-starter.conf -ea -Dbase.dir=/home//rreitzig/Code/hds-webapp -Dgrails.build.listeners=org.jetbrains.groovy.grails.rt.GrailsIdeaTestListener -Dfile.encoding=UTF-8 -classpath /home//rreitzig/.sdkman/candidates/grails/2.5.6/lib/org.codehaus.groovy/groovy-all/jars/groovy-all-2.4.10.jar:/home//rreitzig/.sdkman/candidates/grails/2.5.6/dist/grails-bootstrap-2.5.6.jar org.codehaus.groovy.grails.cli.support.GrailsStarter --classpath /home//rreitzig/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/183.5429.30/plugins/Grails/lib/grails-rt.jar --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf /home//rreitzig/.sdkman/candidates/grails/2.5.6/conf/groovy-starter.conf "test-app functional: -plain-output"
|Loading Grails 2.5.6
|Configuring classpath
.
|Environment set to test
.......................
|Compiling 2 source files
.................................................
|Running Grails application
Error |
Exception in thread "Thread-4"
Error |
java.io.IOException: Cannot run program "java" (in directory "/home//rreitzig/Code/hds-webapp"): error=2, No such file or directory
Error |
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
Error |
at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProcess.fork(ForkedGrailsProcess.groovy:309)
Error |
at org.codehaus.groovy.grails.cli.fork.ForkedGrailsProcess.fork(ForkedGrailsProcess.groovy:264)
Error |
at org.grails.plugins.tomcat.fork.ForkedTomcatServer$_startSecure_closure6.doCall(ForkedTomcatServer.groovy:171)
Error |
at org.grails.plugins.tomcat.fork.ForkedTomcatServer$_startSecure_closure6.call(ForkedTomcatServer.groovy)
Error |
at groovy.lang.Closure.run(Closure.java:495)
Error |
at java.lang.Thread.run(Thread.java:748)
Error |
Caused by: java.io.IOException: error=2, No such file or directory
Error |
at java.lang.UNIXProcess.forkAndExec(Native Method)
Error |
at java.lang.UNIXProcess.(UNIXProcess.java:247)
Error |
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
Error |
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
Error |
... 6 more
Process finished with exit code 130 (interrupted by signal 2: SIGINT)
```
Also, the tool window doesn't pick up on the failure and keeps spinning.
This is with and without "Include parent environment variables" selected.
The parent environment does not include any SDKMAN! variables; that is expected if IDEA is started through a launcher, not a shell. While it's certainly the case that the `java` executable is only on the PATH if the bash initialization script of SDKMAN! has been run for the current shell, unmodified run configurations work just fine.
---
*Imported from [IDEA-207244](https://youtrack.jetbrains.com/issue/IDEA-207244) · Type: Bug · Votes: 0*
*Comments, attachments, dates and reporter are not part of the export — follow the link above for the full history.*
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the Grails test run configuration failure on Ubuntu with SDKMAN!-managed Java, with and without parent environment variables. Start with the stack-trace entry points ForkedGrailsProcess.groovy and ForkedTomcatServer.groovy, then trace how the test process is launched. Done means the configured environment variable is available to the application, tests execute successfully, and the tool window reports failures instead of spinning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java, linux
- Domain
- developer-experience, testing, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100