May take openHAB a few seconds to realize there is a new bundle and to reinitilize it after it's been copied.You can now make changes, set breakpoints, etc. Connecting to the openHAB instance (the debug call stack should show a bunch of openHAB type threads running).The resulting JAR is copied to the openHAB addons directory ( openhab_addons).The Maven compile occuring (successfully).Press F5 (or bring up debug in VSCode and choose the "Debug (Attach) - openHAB" configuration) and the following should occur in the VSCode terminal.You should see openHAB startup in a new VSCode terminal. Press CTRL-SHIFT-P -> Tasks: Run Task -> Start openHAB (Debug) to start an openHAB instance in debug mode.Verify that VSCode can build the system and connect to a debug instance of openHAB: This can be skipped if running locally (localhost) Set the hostName to the hostname running openHAB.This can be skipped if xxxx was 5005 from step 7. vscode directory (example: %BASE%/openhab-addons/bundles//.vscode/launch.json) Listening for transport dt_socket at address: xxxx (where xxxx should be 5005)ĭownload launch.json (opens new window) to the. You should see the following line printed somewhere in the karaf console: Start the openHAB instance with the debug option - start.bat debug from a console in the openHAB home directory. Stop any openHAB instance (if it's running). Set dist to the name of the JAR file Maven is producing in the target directory.Set openhab_* to the directories for your openHAB installation.vscode directory (example: %BASE%/openhab-addons/bundles//.vscode/tasks.json) From VSCode - use File->Open Folder->choose bundle directory (example: %BASE%/openhab-addons/bundles/)Ĭreate a ".vscode" directory under the bundle (example: %BASE%/openhab-addons/bundles//.vscode)ĭownload tasks.json (opens new window) to the. Open VSCode and then open the folder of the bundle. Should produce a jar file in the 'target' directory of the bundle(example: %BASE%/openhab-addons/bundles//target/-3.1.0-SNAPSHOT.jar).mvn clean install -DskipChecks in the console to build the bundle.Open console to the bundle location (example: %BASE%/openhab-addons/bundles/).These steps will show how to setup the Russound bundle but are generic to any bundle in the system.Įnsure the bundle builds correctly (natively with Maven) The following steps will show you how to setup a specific bundle for development with VSCode. vscode/settings.json file in the bundle (similar to tasks.json/ launch.json below).ĭownload settings.json (opens new window) for the recommended settings (or simply wish to copy the URLs in the above image). You can also define them local to a specific bundle by putting those lines in the. If you want to setup openHAB code formatting guidelines, add the following to the VSCode settings:Įither globally define the formatting options via Files->Preferences->Settings->Extensions->Java configuration (or in the global settings.json). vscode/settings.json file in the bundle (similar to tasks.json/ launch.json below). "": "C:\\Windows\\sysnative\\WindowsPowerShell\\v1.0\\powershell.exe"Įither globally define the options via the global settings.json. If not configured already, add the following to the VSCode settings: On Windows, VSCode should be configured to use powershell instead of the classic command line. Install Java Extension Pack for VSCode ( (opens new window))Ĭlone the addons ( (opens new window) or preferably your own fork) to %BASE%\openhab-addons The following steps will only need to be done once to setup both VSCode and your environment. This guide assumes you have a base development directory already defined (example: c:/users/me/development) and will reference that directory as %BASE%. Please note that the instructions show a Win10 system but should be similar for macOS/Linux. The following shows the steps for building a bundle using Visual Studio Code (VSCode). Advanced Functionality and Administrative Tasks.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |