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

SVT: When I start and stop an application using Liberty Tools, I cannot start it again in the same terminal #807

Open rumanaHaque opened 3 weeks ago

rumanaHaque commented 3 weeks ago

As part of testing the Liberty Tools IntelliJ, I installed the eBuy application - as documented in this test - https://github.ibm.com/websphere/system-test/issues/1102 I can start and stop the application successfully, but when I click on Start again from the Liberty Tools, it fails with this exception.

rumanahaque@Rumanas-MacBook-Pro-New ebuy-ee10 % cd "/Users/rumanahaque/Documents/Ebuy/ebuy-ee10/eBuy-runtimeutil"
rumanahaque@Rumanas-MacBook-Pro-New eBuy-runtimeutil % "/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/mvn" io.openliberty.tools:liberty-maven-plugin:dev 
[INFO] Scanning for projects...
[WARNING] Ignored invalid goal specification ':liberty-maven-plugin:install-server' from lifecycle mapping for phase prepare-package
[INFO] 
[INFO] ------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-runtimeutil >------------
[INFO] Building eBuy-runtimeutil 1.0.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------[ liberty-assembly ]--------------------------
[WARNING] The POM for com.ibm.ws.svt.eb.eBuy-ee10:ebuy:ear:1.0.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.912 s
[INFO] Finished at: 2024-06-07T14:00:30-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project eBuy-runtimeutil: Could not resolve dependencies for project com.ibm.ws.svt.eb.eBuy-ee10:eBuy-runtimeutil:liberty-assembly:1.0.0-SNAPSHOT: The following artifacts could not be resolved: com.ibm.ws.svt.eb.eBuy-ee10:ebuy:ear:1.0.0-SNAPSHOT (absent): Could not find artifact com.ibm.ws.svt.eb.eBuy-ee10:ebuy:ear:1.0.0-SNAPSHOT -> [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/DependencyResolutionException
rumanahaque@Rumanas-MacBook-Pro-New eBuy-runtimeutil % 
rumanaHaque commented 3 weeks ago

This is what I see when I refresh the Liberty Tools, and it starts successfully in a new Terminal.

"/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/mvn" io.openliberty.tools:liberty-maven-plugin:dev 
cd "/Users/rumanahaque/Documents/Ebuy/ebuy-ee10/eBuy-runtimeutil"
rumanahaque@Rumanas-MacBook-Pro-New ebuy-ee10 % "/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/mvn" io.openliberty.tools:liberty-maven-plugin:dev 
[INFO] Scanning for projects...
[WARNING] Ignored invalid goal specification ':liberty-maven-plugin:install-server' from lifecycle mapping for phase prepare-package
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] eBuy-ee10                                                          [pom]
[INFO] eBuy-ejb                                                           [ejb]
[INFO] eBuy-ext                                                           [war]
[INFO] eBuy-web                                                           [war]
[INFO] ebuy                                                               [ear]
[INFO] eBuy-runtimeutil                                      [liberty-assembly]
[INFO] 
[INFO] ---------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-ee10 >----------------
[INFO] Building eBuy-ee10 1.0-SNAPSHOT                                    [1/6]
[INFO]   from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- liberty:3.7.1:dev (default-cli) @ eBuy-ee10 ---
[INFO] 
[INFO] ----------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-ejb >----------------
[INFO] Building eBuy-ejb 1.0.0-SNAPSHOT                                   [2/6]
[INFO]   from eBuy-ejb/pom.xml
[INFO] --------------------------------[ ejb ]---------------------------------
[INFO] 
[INFO] --- liberty:3.7.1:dev (default-cli) @ eBuy-ejb ---
[INFO] Running maven-resources-plugin:resources
[INFO] Copying 9 resources from src/main/resources to target/classes
[INFO] Running maven-compiler-plugin:compile on /Users/rumanahaque/Documents/Ebuy/ebuy-ee10/eBuy-ejb/pom.xml
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] ----------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-ext >----------------
[INFO] Building eBuy-ext 1.0.0-SNAPSHOT                                   [3/6]
[INFO]   from eBuy-ext/pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- liberty:3.7.1:dev (default-cli) @ eBuy-ext ---
TrevCraw commented 3 weeks ago

I suspect that the root cause for this issue is the same as https://github.com/OpenLiberty/liberty-tools-intellij/issues/797. When resolving https://github.com/OpenLiberty/liberty-tools-intellij/issues/797, we should ensure this scenario is resolved as well.

turkeylurkey commented 3 weeks ago

@rumanaHaque When I extract ebuy-ee10, cd to eBuy-runtimeutil and run mvn io.openliberty.tools:liberty-maven-plugin:dev I also get the error "Could not resolve dependencies for project com.ibm.ws.svt.eb.eBuy-ee10:eBuy-runtimeutil:liberty-assembly:1.0.0-SNAPSHOT: Could not find artifact com.ibm.ws.svt.eb.eBuy-ee10:ebuy:ear:1.0.0-SNAPSHOT"

git clone git@github.ibm.com:was-svt/ebuy-ee10.git
cd ebuy-ee10
cd eBuy-runtimeutil
mvn io.openliberty.tools:liberty-maven-plugin:dev
...
[ERROR] Failed to execute goal on project eBuy-runtimeutil: Could not resolve dependencies for project com.ibm.ws.svt.eb.eBuy-ee10:eBuy-runtimeutil:liberty-assembly:1.0.0-SNAPSHOT: Could not find artifact com.ibm.ws.svt.eb.eBuy-ee10:ebuy:ear:1.0.0-SNAPSHOT -> [Help 1]

Is this the correct behaviour?

turkeylurkey commented 3 weeks ago

If I cd to the root project a server starts correctly.

pg@Sofia eBuy-runtimeutil % cd ..
pg@Sofia ebuy-ee10 % mvn io.openliberty.tools:liberty-maven-plugin:dev 
[INFO] Scanning for projects...
[WARNING] Ignored invalid goal specification ':liberty-maven-plugin:install-server' from lifecycle mapping for phase prepare-package
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] eBuy-ee10                                                          [pom]
[INFO] eBuy-ejb                                                           [ejb]
[INFO] eBuy-ext                                                           [war]
[INFO] eBuy-web                                                           [war]
[INFO] ebuy                                                               [ear]
[INFO] eBuy-runtimeutil                                      [liberty-assembly]
...
[INFO] 
[INFO] ---------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-ee10 >----------------
[INFO] Building eBuy-ee10 1.0-SNAPSHOT                                    [1/6]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- liberty-maven-plugin:3.8.2:dev (default-cli) @ eBuy-ee10 ---
[INFO] 
[INFO] ----------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-ejb >----------------
[INFO] Building eBuy-ejb 1.0.0-SNAPSHOT                                   [2/6]
[INFO] --------------------------------[ ejb ]---------------------------------
...
[INFO] 
[INFO] --- liberty-maven-plugin:3.8.2:dev (default-cli) @ eBuy-ejb ---
[INFO] Running maven-resources-plugin:resources
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 9 resources
[INFO] Running maven-compiler-plugin:compile on /Users/pg/WASDevEx/testing2024/ebuy-ee10/eBuy-ejb/pom.xml
...
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 12 source files to /Users/pg/WASDevEx/testing2024/ebuy-ee10/eBuy-ejb/target/classes
[WARNING] bootstrap class path not set in conjunction with -source 8
[INFO] 
[INFO] ----------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-ext >----------------
[INFO] Building eBuy-ext 1.0.0-SNAPSHOT                                   [3/6]
[INFO] --------------------------------[ war ]---------------------------------
...
[INFO] 
[INFO] --- liberty-maven-plugin:3.8.2:dev (default-cli) @ eBuy-ext ---
[INFO] Running maven-resources-plugin:resources
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/pg/WASDevEx/testing2024/ebuy-ee10/eBuy-ext/src/main/resources
[INFO] Running maven-compiler-plugin:compile on /Users/pg/WASDevEx/testing2024/ebuy-ee10/eBuy-ext/pom.xml
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/pg/WASDevEx/testing2024/ebuy-ee10/eBuy-ext/target/classes
[WARNING] bootstrap class path not set in conjunction with -source 8
[INFO] 
[INFO] ----------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-web >----------------
[INFO] Building eBuy-web 1.0.0-SNAPSHOT                                   [4/6]
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
turkeylurkey commented 3 weeks ago

With the latest pull request #808 I can confirm the Start command fails consistently as expected. It does not succeed the first time and fail if you run it a second time.

TrevCraw commented 3 weeks ago

@rumanaHaque Has this project been used for SVT for LT IntelliJ previously?

turkeylurkey commented 3 weeks ago

I tried this project with Liberty Tools IntelliJ 24.0.3 and when I try to start the one Liberty server it fails.

cd "/Users/pg/testing2024/ebuy-ee10/eBuy-runtimeutil"                                                                                                 
pg@Sofia ebuy-ee10 % cd "/Users/pg/testing2024/ebuy-ee10/eBuy-runtimeutil"
pg@Sofia eBuy-runtimeutil % "/Users/pg/IntelliJ IDEA CE 2023-3-6.app/Contents/plugins/maven/lib/maven3/bin/mvn" io.openliberty.tools:liberty-maven-plugin:dev 
[INFO] Scanning for projects...
[WARNING] Ignored invalid goal specification ':liberty-maven-plugin:install-server' from lifecycle mapping for phase prepare-package
[INFO] 
[INFO] ------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-runtimeutil >------------
[INFO] Building eBuy-runtimeutil 1.0.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------[ liberty-assembly ]--------------------------
[WARNING] The POM for com.ibm.ws.svt.eb.eBuy-ee10:ebuy:ear:1.0.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.330 s
[INFO] Finished at: 2024-06-11T09:56:29-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project eBuy-runtimeutil: Could not resolve dependencies for project com.ibm.ws.svt.eb.eBuy-ee10:eBuy-runtimeutil:liberty-assembly:1.0.0-SNAPSHOT: The following artifacts could not be resolved: com.ibm.ws.svt.eb.eBuy-ee10:ebuy:ear:1.0.0-SNAPSHOT (absent): Could not find artifact com.ibm.ws.svt.eb.eBuy-ee10:ebuy:ear:1.0.0-SNAPSHOT -> [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/DependencyResolutionException
pg@Sofia eBuy-runtimeutil % 
rumanaHaque commented 3 weeks ago

I don't try to start the Liberty server from command line - just using the Liberty Tools.

image

When I try it there for the first time - it succeeds.

"/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/mvn" io.openliberty.tools:liberty-maven-plugin:dev -DhotTests=true
cd "/Users/rumanahaque/Documents/Ebuy/ebuy-ee10/eBuy-runtimeutil"
rumanahaque@Rumanas-MacBook-Pro-New ebuy-ee10 % "/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/mvn" io.openliberty.tools:liberty-maven-plugin:dev -DhotTests=true
[INFO] Scanning for projects...
[WARNING] Ignored invalid goal specification ':liberty-maven-plugin:install-server' from lifecycle mapping for phase prepare-package
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] eBuy-ee10                                                          [pom]
[INFO] eBuy-ejb                                                           [ejb]
[INFO] eBuy-ext                                                           [war]
[INFO] eBuy-web                                                           [war]
[INFO] ebuy                                                               [ear]
[INFO] eBuy-runtimeutil                                      [liberty-assembly]
[INFO] 
[INFO] ---------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-ee10 >----------------
[INFO] Building eBuy-ee10 1.0-SNAPSHOT                                    [1/6]
[INFO]   from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- liberty:3.7.1:dev (default-cli) @ eBuy-ee10 ---
Downloading from central: https://repo.maven.apache.org/maven2/io/openliberty/openliberty-kernel/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/io/openliberty/openliberty-kernel/maven-metadata.xml (2.7 kB at 6.1 kB/s)
[INFO] 
[INFO] ----------------< com.ibm.ws.svt.eb.eBuy-ee10:eBuy-ejb >----------------
[INFO] Building eBuy-ejb 1.0.0-SNAPSHOT                                   [2/6]
[INFO]   from eBuy-ejb/pom.xml
[INFO] --------------------------------[ ejb ]---------------------------------
[INFO] 
rumanaHaque commented 3 weeks ago

@rumanaHaque Has this project been used for SVT for LT IntelliJ previously?

Yes, this application has been used several times earlier to test IntelliJ. The most recent testing was in 24.0.3. Here's a link to the TER - https://github.ibm.com/websphere/system-test/issues/1014 https://github.ibm.com/websphere/system-test/issues/1014#issuecomment-74651587

turkeylurkey commented 3 weeks ago

The TER doesn't show the commands issued by the liberty tool so I can't tell if they are in order or not.

rumanaHaque commented 3 weeks ago

Although this has been tested earlier (using the same project) - may be every time it was done, the terminal was closed after the first Start and Stop. So by default a new terminal opened up, and so we didn't see the problem.

TrevCraw commented 2 weeks ago

@rumanaHaque It looks like it is required to run dev mode from the root directory of this multi-module project, ebuy-ee10. Or if running from a project sub-directory, it is required to specify the root pom.xml in the ebuy-ee10 directory using a Maven parameter (i.e. -f ../pom.xml).

In both 24.0.3 and 24.0.6, the LTI tool window only detects the eBuy-runtimeutil module, since this is the only module with the LMP defined in its pom.xml. If Liberty: Start is run for this module from the tool window, it will not work, since the built in behaviour in LTI is to cd to the directory of the project/module the Start action was run against - the eBuy-runtimeutil directory in this case. The reason it worked the first time as you reported in this bug was actually due to a bug in the 24.0.6-SNAPSHOT where the cd command was being run after the Start command (#797). With that bug resolved, the behaviour between 24.0.3 and 24.0.6 is consistent, and Liberty: Start will not work out of the box on this project.

To run this project using LTI, these are the following two options:

  1. Run Liberty: Start... on the eBuy-runtimeutil module to create a new Liberty Run/Debug configuration. You can then specify the following for "Start parameters": -f ../pom.xml. This will target the root POM file in ebuy-ee10 when running the project from the eBuy-runtimeutil directory. You may need to add other multi-module related parameters as specified in the dev mode docs here: https://github.com/OpenLiberty/ci.maven/blob/main/docs/dev.md#multiple-modules
  2. Manually add a new Liberty project to the Liberty tool window. Steps to manually add a new Liberty project can be found here: https://github.com/OpenLiberty/liberty-tools-intellij/blob/main/docs/user-guide.md#manually-add-your-liberty-project-to-the-tool-window (you can use "shift + shift" to open the IntelliJ Search Everywhere window). When selecting a project to add, select eBuy-ee10. Once added to the Liberty tool window, you should be able to use Liberty: Start to run the project.

Please let me know how these options work for you.