Note: Starting with the 0.0.8 early release, Java 17 (bundled with IntelliJ IDEA version 2022.2+) and a minimum version of IntelliJ IDEA version 2022.2 are required to run Liberty Tools for IntelliJ IDEA.
This extension is built using the gradle-intellij-plugin.
-
Clone this repository:
git clone [email protected]:OpenLiberty/liberty-tools-intellij.git
-
Import this repository as a Gradle project in IntelliJ IDEA
-
Run
./gradlew runIde --stacktrace
. A new IntelliJ IDEA window will launch with the Liberty Tools plugin installed to it. You can connect the IntelliJ IDEA debugger to this process to debug the plugin.OR
Run
./gradlew buildPlugin
to build an installable zip inbuild/distributions/liberty-tools-intellij-xxx.zip
. You can install this zip in IntelliJ IDEA through Preferences > Plugins > Gear icon > Install Plugin from Disk... and select theliberty-tools-intellij-xxx.zip
.
Liberty Tools for IntelliJ consumes the Liberty Config Language Server, Eclipse LSP4Jakarta, and Eclipse LSP4MP projects. The language server JARS are automatically downloaded from Maven Central and the Eclipse repository. The following instructions explain how to build these JARs locally and run them with Liberty Tools for IntelliJ IDEA.
- Follow the Liberty Config Language Server build instructions to build the
lemminx-liberty-x.x-SNAPSHOT.jar
andliberty.ls-x.x-SNAPSHOT.jar
. - In the build.gradle file, update references to the
liberty-langserver-lemminx
andliberty-langserver
to point to the versions built in the previous step. - Until #173 is fixed, update the jar versions in
io.openliberty.tools.intellij.liberty.lsp.LibertyXmlServer
andio.openliberty.tools.intellij.liberty.lsp.LibertyConfigLanguageServer
.
To debug the LemMinX Language Server in IntelliJ, complete the following steps.
- Start Liberty Tools for IntelliJ by creating an IntelliJ debug configuration for the
./gradlew runIde command
. - Create a new debug configuration: Remote JVM Debug --> specify localhost, port 1054 and command line arguments
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:1054
- In
io.openliberty.tools.intellij.liberty.lsp.LibertyXmlServer.LibertyXmlServer()
replace the lineparams.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1054,quiet=y");
withparams.add("-agentlib:jdwp=transport=dt_socket,server=y,address=1054");
. - Start the debug configuration created in step 2. You can now step through the LemMinX LS code now with the IntelliJ debugger.
- Follow the Eclipse LSP4Jakarta build instructions to build the
org.eclipse.lsp4jakarta.ls-x.x.x-SNAPSHOT-jar-with-dependencies.jar
. You do not need to build thelsp4jakarta.jdt
orlsp4jakarta.eclipse
components. - In the build.gradle file, update references to the
org.eclipse.lsp4jakarta.ls
to point to the version built in the previous step.
- Follow the Eclipse LSP4MP build instructions to build the
org.eclipse.lsp4mp.ls-x.x.x-SNAPSHOT-jar-with-dependencies.jar
. You do not need to build thelsp4mp.jdt
component. - In the build.gradle file, update references to the
org.eclipse.lsp4mp.ls
to point to the version built in the previous step.
- Click the Language Servers tool window in the IntelliJ IDE to show the LSP Consoles.
- Select the language server you wish to monitor and then select Trace: messages or verbose.
- Messages to and from the language server will appear in the console, so you can verify the messages sent in response to user actions in the IDE.
For more information, see the LSP console user guide
For details on the Continuous Integration (CI) setup for LSP4IJ integration, refer to the LSP4IJ Continuous Integration documentation.
Add localized strings in src/main/resources/messages/LibertyBundles_{locale}.properties
. The default message file is LibertyBundles.properties
.
-
Add new messages in
src/main/resources/messages/LibertyBunldes_{locale}.properties
file. If message has parameters, use curly brackets to enclose them:{0}
,{1}
... -
Add the following import statement in your source code:
import io.openliberty.tools.intellij.util.LocalizedResourceUtil;
-
Call method
LocalizedResourceUtil.getMessage
to return localized message.Example without parameters:
String message = LocalizedResourceUtil.getMessage("my.message.key");
Example with parameters:
String message = LocalizedResourceUtil.getMessage("my.message.key.with.params", param1, param2);
To record videos for all tests, not just the failed ones, you can create a video.properties
file in the src/test/resources
directory and add video.save.mode=ALL
to that file.