OpenLiberty / liberty-tools-intellij

IntelliJ IDEA extension for Liberty
https://plugins.jetbrains.com/plugin/14856-open-liberty-tools
Eclipse Public License 2.0
11 stars 20 forks source link

FVT: The "Liberty: Start" commands are failing in the initial run when the parent directory for Liberty project(s) is open in the Project window #797

Closed aparnamichael closed 3 weeks ago

aparnamichael commented 1 month ago

When we execute dev/devc command for the first time it is failing because of 'No such file/directory' error. Os- Redhat LTI version: 24.0.6

Logs : 024.1.2/idea-IC-241.17011.79/plugins/maven/lib/maven3/bin/mvn" io.openliberty.tools:liberty-maven-plugin:devc cd "/root/Documents/test-one/app-name-testone" [root@c2826v1 test-one]# "/root/Documents/24.0.6-test/ideaIC-2024.1.2/idea-IC-241.17011.79/plugins/maven/lib/maven3/bin/mvn" io.openliberty.tools:liberty-maven-plugin:devc [INFO] Scanning for projects... [INFO] [INFO] ------------------< org.apache.maven:standalone-pom >------------------- [INFO] Building Maven Stub Project (No POM) 1 [INFO] --------------------------------[ pom ]--------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.269 s [INFO] Finished at: 2024-06-05T00:57:20-07:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.9:devc (default-cli): Goal requires a project to execute but there is no POM in this directory (/root/Documents/test-one). Please verify you invoked Maven from the correct directory. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException


turkeylurkey commented 1 month ago

I believe the problem is LibertyActionUtil.executeCommand() calls ShellTerminalWidget.executeCommand(cmd). Here we see

doWithTerminalStarter(terminalStarter -> {
      TerminalUtil.sendCommandToExecute(shellCommand, terminalStarter);

which uses a CompletableFuture to put the commands on another thread. Then they are executed in the wrong order.

mrglavas commented 1 month ago

On Windows, I'm noticing that the dev mode commands are being run in the root directory of the project, with no cd command being run prior to the dev mode command. This was tested with: https://github.com/OpenLiberty/guide-microprofile-rest-client-async which contains multiple projects.

image

mrglavas commented 1 month ago

I noticed that if I run the Liberty: Start action a second time without closing the terminal window, that it does change the directory before running the Maven command.

image

This makes me wonder if there's an attempt to run the cd command before the terminal window has had a chance to initialize and instead of running the command the request is getting lost.