diff --git a/docs/java-application-development/development-environment-setup.md b/docs/java-application-development/development-environment-setup.md index 3225765ba18..7250673a907 100644 --- a/docs/java-application-development/development-environment-setup.md +++ b/docs/java-application-development/development-environment-setup.md @@ -1,184 +1,161 @@ # Development Environment Setup -This document describes how to set up the development environment for Kura, which consists of the following components: +In this document we'll cover the required steps to setup the Development Environment for contributing to the Eclipse Kura project. If, instead, you want to develop applications or bundles running on Eclipse Kura refer to the [Eclipse Kura Workspace setup guide](./kura-workspace-setup.md). -* JVM (Java JDK SE 8) +The Eclipse Kura development environment may be installed on Windows, Linux, or Mac OS. The setup instructions will be the same across each OS though each system may have unique characteristics. -* Eclipse IDE - -* Kura Workspace setup - -The Kura development environment may be installed on Windows, Linux, or Mac OS. The setup instructions will be the same across each OS though each system may have unique characteristics. !!! info - The local emulation of Kura code is only supported in Linux and Mac, not in Windows. - -## JVM Installation + The local emulation of Eclipse Kura code is only supported in Linux and Mac, not in Windows. -Download and install JDK SE 8 from the following links as appropriate for your OS. +This document will cover the use of Eclipse Oomph installer which is the easiest way to install and configure the Eclipse IDE to start contributing to Eclipse Kura. -For Windows and Linux users, the JDK can be downloaded from the following link: [Java SE 8 Downloads](https://adoptium.net/temurin/releases/?version=8). Use the latest version of Java SE Development Kit and download the version appropriate for your system. +The setup requires three basic steps: -For additional information regarding the installation of Java 8 on all supported operating systems, see [JDK 8 and JRE 8 Installation Guide](https://adoptium.net/installation). +1. Requirements installation +2. Eclipse Oomph setup +3. Eclipse Kura maven build +## Requirements -## Eclipse IDE +Before building Eclipse Kura, you need to have the following programs installed in your system: -The Eclipse IDE is an open source development tool that consists of an integrated development environment (IDE) and a plug-in system for managing extensions. +- JDK 1.8 (or JDK 17) +- Maven 3.5.x (or greater) -### Installing Eclipse - -Before installing Eclipse, you should choose directory locations for the Eclipse install and its workspaces. - -!!! info - The following points should be kept in mind regarding Eclipse installs and workspaces: +Recommended additional software: - - The directory location of the Eclipse workspaces should be chosen carefully. - Once Eclipse is installed and workspaces are created, they should never be moved to another location in the file system.
- - There may be multiple installs of Eclipse (of different or similar versions), and single instances of each install can be run simultaneously; but there should never be more that one instance of a specific install running at the same time (to avoid corruption to the Eclipse environment).
- - Each workspace should be used with only one Eclipse install. You should avoid opening the workspace from more than one installation of Eclipse.
- - For the purposes of this guide, only a single Eclipse installation will be covered. +- Git -Download the current distribution of Eclipse for your OS from [Eclipse official website](https://www.eclipse.org/downloads/packages/). Choose the **Eclipse IDE for Eclipse Committers**. +#### Installing Prerequisites in Mac OS -The zipped Eclipse file will be downloaded to the local file system and can be saved to a temporary location that can be deleted after Eclipse has been installed. After the file has been downloaded, it should be extracted to the Eclipse installs directory. The following screen capture shows the installation in Linux using an **eclipse\installs** directory. The Eclipse executable will then be found in the **eclipse\installs\eclipse** directory. -This installation will be different depending on the operating system. +To install Java 8, download the JDK tar archive from the [Adoptium Project Repository](https://adoptium.net/releases.html?variant=openjdk8&jvmVariant=hotspot). -![Eclipse Install Folder](./images/development-environment-setup/image1.png) - -Because there may potentially be future Eclipse installs extracted into this location, before doing anything else, rename the directory, such as **eclipse\installs\juno1\\**. -!!! warning - Once you begin using this Eclipse install, it should NOT be moved or renamed. - -![Eclipse Install Folder 2](./images/development-environment-setup/image2.png) - -## Workspaces - -### Creating an Eclipse Workspace +Once downloaded, copy the tar archive in `/Library/Java/JavaVirtualMachines/` and cd into it. Unpack the archive with the following command: +```bash +sudo tar -xzf .tar.gz +``` +The tar archive can be deleted afterwards. + +Depending on which terminal you are using, edit the profiles (.zshrc, .profile, .bash_profile) to contain: +```bash +# Adoptium JDK 8 +export JAVA_8_HOME=/Library/Java/JavaVirtualMachines//Contents/Home +alias java8='export JAVA_HOME=$JAVA_8_HOME' +java8 +``` +Reload the terminal and run `java -version` to make sure it is installed correctly. -Run Eclipse by clicking its executable in the install directory. +Using [Brew](https://brew.sh/) you can easily install Maven from the command line: +```bash +brew install maven@3.5 +``` +Run `mvn -version` to ensure that Maven has been added to the PATH. If Maven cannot be found, try running `brew link maven@3.5 --force` or manually add it to your path with: +```bash +export PATH="/usr/local/opt/maven@3.5/bin:$PATH" +``` -When Eclipse is run for the first time, a workspace needs to be created. A single workspace will contain all the Java code/projects/bundles, Eclipse configuration parameters, and other relevant files for a specific business-level product. If the **Use this as the default** option is selected, the designated workspace becomes the default each time you run Eclipse. +#### Installing Prerequisites in Linux -If a workspace has not already been defined, or if you are creating a different workspace for another development project, enter a new workspace name. The workspace should be named appropriate to the project/product being developed. +For Java +```bash +sudo apt install openjdk-8-jdk +``` -!!! warning - Once you begin using a particular workspace, it should NOT be moved or renamed at any time. +For Maven -Otherwise, select an existing workspace and click **OK**. After Eclipse is running, you can select the Eclipse menu **File | Switch Workspace | Other** to create or open a different workspace. +You can follow the tutorial from the official [Maven](http://maven.apache.org/install.html) site. Remember that you need to install 3.5.x version or greater. -![Workspace Launcher](./images/development-environment-setup/image3.png) +### Eclipse Oomph setup -After the new workspace opens, click the Workbench icon to display the development environment. +Download the latest Eclipse Installer appropriate for your platform from the [Eclipse Downloads page](https://www.eclipse.org/downloads/packages/installer) and start it. -![Workspace](./images/development-environment-setup/image4.png) +![](./images/development-environment-setup/devenvsetup-0.png) -!!! info - Additional workspace configuration: +Switch to "Advanced Mode" (top right hamburger menu) and select "Eclipse IDE for Eclipse Committers" and configure the "Product Version" to be the version 2023-03 or newer. - - In the Eclipse workspace modify the lifecycle mapping by adding these XML lines to the `lifecycle-mapping-metadata.xml` in Kura workspace. - You can find the file in the Windows -> Preferences -> Maven -> Lifecycle Mappings -> Open workspace lifecycle mappings metadata. - After editing the file, reload it by pressing the "Reload workspace lifecycle mappings metadata" button. - ```xml - - - - - org.eclipse.m2e.pde.connector - [2.1.2,) - - eclipse-test-plugin - eclipse-plugin - eclipse-feature - - - - - ``` - - Install the `eclipse-tycho` plugin following this steps: - 1. Menu Help -> Install new software... -> Paste the [m2eclipse-tycho repository URL](https://github.com/tesla/m2eclipse-tycho/releases/download/latest/) in the `Work with:` text field -> expand the category and select the `Tycho Project Configurators Feature` and proceed with the installation. - 2. Then restart Eclipse. +![](./images/development-environment-setup/devenvsetup-1.png) -### Importing the Kura User Workspace +![](./images/development-environment-setup/devenvsetup-2.png) -To set up your Kura project workspace, you will need to download the Kura User Workspace archive from [Eclipse Kura Download Page](https://eclipse.dev/kura/downloads.php). +Select the Eclipse Kura installer from the list. If this is not available, add a new installer from [https://raw.githubusercontent.com/eclipse/kura/develop/kura/setups/kura.setup](https://raw.githubusercontent.com/eclipse/kura/develop/kura/setups/kura.setup), then check and press the "Next" button. -From the Eclipse File menu, select the **Import** option. In the Import dialog box, expand the **General** heading, select **Existing Projects into Workspace**, and then click **Next**. +![](./images/development-environment-setup/devenvsetup-3.png) -Now click the **Select archive file** option button and browse to the archive file, such as *user_workspace_archive_.zip*. +**Variables setup** -![Import Project](./images/development-environment-setup/image5.png) +- Select the "Developer Type": + - **"User"**: if you want to develop applications or bundles running on Eclipse Kura, select this option. It will install only the APIs and the examples. + - **"Developer"**: if you are a framework developer, select this option. It will download and configure the Eclipse Kura framework (for the purpose of this document we'll use this option) +- Set the `JRE 1.8 location` value to the installed local jdk-8 VM +- Update Eclipse Kura Git repository username (prefer the anonymous HTTPS option, link to your fork) and customize further settings if you like (e.g. Root install folder, Installation folder name). To show these options, make sure that the "Show all variables" checkbox is enabled. -Finally, click **Finish** to import the projects. At this point, you should have four projects in your workspace. The four projects are as follows: +If you plan to contribute to Eclipse Kura you might want to [create a fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo), see our [contributing guide](https://github.com/eclipse/kura/blob/develop/CONTRIBUTING.md) for further informations. For the purpose of this tutorial we'll work with a fictional fork for the username `user`. To clone the repo use the link appropriate for your fork, in our case it will be: `https://github.com/user/kura.git` -* org.eclipse.kura.api – the core Kura API. +Keep in mind that the "Root install folder" is where the Eclipse executable will be installed and the Eclipse Kura sources will be downloaded (in the `git` subfolder). -* org.eclipse.kura.demo.heater – an example project that you can use as a starting point for creating your own bundle. +![](./images/development-environment-setup/devenvsetup-4.png) -* org.eclipse.kura.emulator – the emulator project for running Kura within Eclipse (Linux/Mac only). +Press Next, leave all Bootstrap Tasks selected and press the Finish button -* target-definition – a set of required bundles that are dependencies of the APIs and Kura. +![](./images/development-environment-setup/devenvsetup-5.png) - ![Import Project](./images/development-environment-setup/image6.png) +Accept all the licenses and wait for the installation to finish. -Eclipse will also report some errors at this point. See the next section to resolve those errors. +![](./images/development-environment-setup/devenvsetup-6.png) -### Workspace Setup -This section will guide the users to configure the development workspace environment. +At first startup Eclipse IDE will checkout the code, perform a full build and configure a few Working Sets -#### JRE Configuration -The latest Eclipse IDEs require and configure, by default, a Java 11 environment. -In order to be able to leverage and develop using the new workspace for Kura, the user will be required to perform a one-time operation to specify to the IDE a Java 8 JDK. -Opening the Eclipse preferences and selecting the Installed JREs in the Java section, the user has to select an installed Java 8 instance. +![](./images/development-environment-setup/devenvsetup-7.png) -![Set JDK 8](./images/development-environment-setup/image7.png) +![](./images/development-environment-setup/devenvsetup-8.png) -After applying the configuration change, the user will be prompted to align also the compiler options. To do so, selecting the Compiler entry in the Java section, the user has to select 1.8 from the list of available Java versions. +When the tasks are completed, go to into the Package Explorer and Target Platform > Target-Definition > Kura Target Platform Equinox 3.16.0, and press "Set as Target Platform" located at the top right of the window: -![Set Compiler 8](./images/development-environment-setup/image8.png) +![](./images/development-environment-setup/devenvsetup-9.png) -After applying the changes, the user will be prompted to recompile the environment. +![](./images/development-environment-setup/devenvsetup-10.png) -#### Target Definition Setup -Click the arrow next to the **target-definition** project in the workspace and double-click **kura-equinox_.target** to open it. +### Eclipse Kura maven build -![Target Definition Setup](./images/development-environment-setup/image9.png) +Navigate to the `git` folder created within the Eclipse workspace (`~/iot-kura-workspace` in the example above) and build the target platform: -In the Target Definition window, click the link **Set as Target Platform**. Doing so will reset the target platform, rebuild the Kura projects, and clear the errors that were reported. At this point, you are ready to begin developing Kura-based applications for your target platform. +```bash +mvn -f target-platform/pom.xml clean install +``` -### Eclipse Oomph installer +Then build the core components: -The Eclipse Oomph installer is an easy way to install and configure the Eclipse IDE to start developing on Kura. -Download the latest Eclipse Installer appropriate for your platform from [Eclipse Downloads](https://www.eclipse.org/downloads/eclipse-packages/) +```bash +mvn -f kura/pom.xml clean install +``` -* Start the Eclipse Installer -* Switch to advanced mode (in simple mode you cannot add a custom installer) -* Select "Eclipse IDE for Eclipse Committers", select the latest "Product Version" and select a Java 11+ VM. Then click the Next button. +Build the examples (optional): - ![Eclipse Installer](./images/development-environment-setup/image10.png) +```bash +mvn -f kura/examples/pom.xml clean install +``` -* Select "Eclipse Kura" project under the "Eclipse Projects" menu. If it isn't available, add a new installer that you can find [here]( https://raw.githubusercontent.com/eclipse/kura/develop/kura/setups/kura.setup) under the "Github Projects" menu. Then click the Next button. +Build the target profiles: - ![Kura Oomph](./images/development-environment-setup/image11.png) +```bash +mvn -f kura/distrib/pom.xml clean install -DbuildAll +``` -* Update Eclipse Kura Git repository's username (prefer the anonymous HTTPS option, link to your fork) and customize further settings if you like (e.g. Root install folder, Installation folder name). -* Set the `JRE 1.8 location` value to the installed local jdk-8 VM. Then click the Next button. -* Leave all Bootstrap Tasks selected and press the Finish button. -* Accept the licenses and unsigned content. -* Wait for the installation to finish, a few additional plugins will be installed. -* At first startup Eclipse IDE will checkout the code and perform a full build. +!!! Note + You can skip tests by adding `-Dmaven.test.skip=true` in the commands above and you can compile a specific target by specifying the profile (e.g. `-Praspberry-pi-armhf`). -The result will be an Eclipse IDE with all the recommended plug-ins already available, code will be checked out and built, workspace will be set up, a few Working Sets will be prepared with most projects building without errors. +#### Build scripts -The next step is to get the rest of the projects to build, for which you might need to build them in the console with specific profiles available e.g. the CAN bundle. +Alternatively you can use the build scripts available in the root directory. -#### Run the Eclipse Kura Emulator +```bash +./build-all.sh +``` -To start the Eclipse Kura emulator, select the "Eclipse Kura Emulator.launch" profile from "Other Projects" -> "setups" -> "launchers" and open it with "Run as" -> "Run Configurations...". Then click on the "Arguments" tab and update the "VM arguments" as follows to adapt the paths to the folder structure created by the Oomph installer: +or -``` shell --Dkura.have.net.admin=false -Dorg.osgi.framework.storage=/tmp/osgi/framework_storage -Dosgi.clean=true -Dosgi.noShutdown=true -Declipse.ignoreApp=true -Dorg.eclipse.kura.mode=emulator -Dkura.configuration=file:${workspace_loc}/../git/kura/kura/emulator/org.eclipse.kura.emulator/src/main/resources/kura.properties -Ddpa.configuration=/tmp/kura/dpa.properties -Dlog4j.configurationFile=file:${workspace_loc}/../git/kura/kura/emulator/org.eclipse.kura.emulator/src/main/resources/log4j.xml -Dkura.data=${workspace_loc}/kura/data -Dkura.snapshots=${workspace_loc}/kura/user/snapshots -Dorg.eclipse.equinox.http.jetty.customizer.class=org.eclipse.kura.jetty.customizer.KuraJettyCustomizer +```bash +./build-menu.sh ``` -![Vm arguments](./images/development-environment-setup/image12.png) - -The Eclipse Kura Web UI will be available at the following URL: http://127.0.0.1:8080 with username and password **admin**. +and select the profiles you want to build. diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-0.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-0.png new file mode 100644 index 00000000000..252f0c778bf Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-0.png differ diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-1.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-1.png new file mode 100644 index 00000000000..6d5eef8f7f2 Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-1.png differ diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-10.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-10.png new file mode 100644 index 00000000000..a973b20ee5a Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-10.png differ diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-2.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-2.png new file mode 100644 index 00000000000..426982c4fba Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-2.png differ diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-3.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-3.png new file mode 100644 index 00000000000..6461b287458 Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-3.png differ diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-4.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-4.png new file mode 100644 index 00000000000..a66981a8a63 Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-4.png differ diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-5.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-5.png new file mode 100644 index 00000000000..1160e418b7d Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-5.png differ diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-6.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-6.png new file mode 100644 index 00000000000..92abf8fd27b Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-6.png differ diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-7.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-7.png new file mode 100644 index 00000000000..91188fea407 Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-7.png differ diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-8.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-8.png new file mode 100644 index 00000000000..e4667b23b6e Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-8.png differ diff --git a/docs/java-application-development/images/development-environment-setup/devenvsetup-9.png b/docs/java-application-development/images/development-environment-setup/devenvsetup-9.png new file mode 100644 index 00000000000..cd099f08cf8 Binary files /dev/null and b/docs/java-application-development/images/development-environment-setup/devenvsetup-9.png differ diff --git a/docs/java-application-development/images/development-environment-setup/image10.png b/docs/java-application-development/images/development-environment-setup/image10.png deleted file mode 100644 index 285941fe6f8..00000000000 Binary files a/docs/java-application-development/images/development-environment-setup/image10.png and /dev/null differ diff --git a/docs/java-application-development/images/development-environment-setup/image11.png b/docs/java-application-development/images/development-environment-setup/image11.png deleted file mode 100644 index d8ca768c17e..00000000000 Binary files a/docs/java-application-development/images/development-environment-setup/image11.png and /dev/null differ diff --git a/docs/java-application-development/kura-workspace-setup.md b/docs/java-application-development/kura-workspace-setup.md new file mode 100644 index 00000000000..4eb6bda9bca --- /dev/null +++ b/docs/java-application-development/kura-workspace-setup.md @@ -0,0 +1,152 @@ +# Kura Workspace Setup + +This document describes how to set up the Eclipse Kura workspace development environment, which consists of the following components: + +- JVM (Java JDK SE 8) +- Eclipse IDE +- Eclipse Kura Workspace + +**This setup will allow you to develop applications or bundles running on Eclipse Kura. It will install only the APIs and the examples.** If you want to contribute to the Eclipse Kura project follow [this guide](./development-environment-setup.md) instead. + +The Eclipse Kura development environment may be installed on Windows, Linux, or Mac OS. The setup instructions will be the same across each OS though each system may have unique characteristics. +!!! info + The local emulation of Eclipse Kura code is only supported in Linux and Mac, not in Windows. + +## JVM Installation + +Download and install JDK SE 8 from the following links as appropriate for your OS. + +For Windows and Linux users, the JDK can be downloaded from the following link: [Java SE 8 Downloads](https://adoptium.net/temurin/releases/?version=8). Use the latest version of the Java SE Development Kit and download the version appropriate for your system. + +For additional information regarding the installation of Java 8 on all supported operating systems, see [JDK 8 and JRE 8 Installation Guide](https://adoptium.net/installation). + +### Installing Eclipse IDE + +Before installing Eclipse, you should choose directory locations for the Eclipse install and its workspaces. + +!!! info + The following points should be kept in mind regarding Eclipse installs and workspaces: + + - The directory location of the Eclipse workspaces should be chosen carefully. + Once Eclipse is installed and workspaces are created, they should never be moved to another location in the file system.
+ - There may be multiple installs of Eclipse (of different or similar versions), and single instances of each install can be run simultaneously; but there should never be more that one instance of a specific install running at the same time (to avoid corruption to the Eclipse environment).
+ - Each workspace should be used with only one Eclipse install. You should avoid opening the workspace from more than one installation of Eclipse.
+ +Download the current distribution of Eclipse for your OS from [Eclipse official website](https://www.eclipse.org/downloads/packages/). Choose the **Eclipse IDE for Eclipse Committers**. + +The zipped Eclipse file will be downloaded to the local file system and can be saved to a temporary location that can be deleted after Eclipse has been installed. After the file has been downloaded, it should be extracted to the Eclipse installs directory. The following screen capture shows the installation in Linux using an **eclipse\installs** directory. The Eclipse executable will then be found in the **eclipse\installs\eclipse** directory. +This installation will be different depending on the operating system. + +![Eclipse Install Folder](./images/development-environment-setup/image1.png) + +Because there may potentially be future Eclipse installs extracted into this location, before doing anything else, rename the directory, such as **eclipse\installs\juno1\\**. +!!! warning + Once you begin using this Eclipse install, it should NOT be moved or renamed. + +![Eclipse Install Folder 2](./images/development-environment-setup/image2.png) + +## Workspaces + +### Creating an Eclipse Workspace + +Run Eclipse by clicking its executable in the install directory. + +When Eclipse is run for the first time, a workspace needs to be created. A single workspace will contain all the Java code/projects/bundles, Eclipse configuration parameters, and other relevant files for a specific business-level product. If the **Use this as the default** option is selected, the designated workspace becomes the default each time you run Eclipse. + +If a workspace has not already been defined, or if you are creating a different workspace for another development project, enter a new workspace name. The workspace should be named appropriate to the project/product being developed. + +!!! warning + Once you begin using a particular workspace, it should NOT be moved or renamed at any time. + +Otherwise, select an existing workspace and click **OK**. After Eclipse is running, you can select the Eclipse menu **File | Switch Workspace | Other** to create or open a different workspace. + +![Workspace Launcher](./images/development-environment-setup/image3.png) + +After the new workspace opens, click the Workbench icon to display the development environment. + +![Workspace](./images/development-environment-setup/image4.png) + +!!! info + Additional workspace configuration: + + - In the Eclipse workspace modify the lifecycle mapping by adding these XML lines to the `lifecycle-mapping-metadata.xml` in Eclipse Kura workspace. + You can find the file in the Windows -> Preferences -> Maven -> Lifecycle Mappings -> Open workspace lifecycle mappings metadata. + After editing the file, reload it by pressing the "Reload workspace lifecycle mappings metadata" button. + ```xml + + + + + org.eclipse.m2e.pde.connector + [2.1.2,) + + eclipse-test-plugin + eclipse-plugin + eclipse-feature + + + + + ``` + - Install the `eclipse-tycho` plugin following this steps: + 1. Menu Help -> Install new software... -> Paste the [m2eclipse-tycho repository URL](https://github.com/tesla/m2eclipse-tycho/releases/download/latest/) in the `Work with:` text field -> expand the category and select the `Tycho Project Configurators Feature` and proceed with the installation. + 2. Then restart Eclipse. + +### Importing the Eclipse Kura User Workspace + +To set up your Eclipse Kura project workspace, you will need to download the Eclipse Kura User Workspace archive from [Eclipse Kura Download Page](https://eclipse.dev/kura/downloads.php). + +From the Eclipse File menu, select the **Import** option. In the Import dialog box, expand the **General** heading, select **Existing Projects into Workspace**, and then click **Next**. + +Now click the **Select archive file** option button and browse to the archive file, such as *user_workspace_archive_.zip*. + +![Import Project](./images/development-environment-setup/image5.png) + +Finally, click **Finish** to import the projects. At this point, you should have four projects in your workspace. The four projects are as follows: + +* org.eclipse.kura.api – the core Eclipse Kura API. + +* org.eclipse.kura.demo.heater – an example project that you can use as a starting point for creating your own bundle. + +* org.eclipse.kura.emulator – the emulator project for running Eclipse Kura within Eclipse (Linux/Mac only). + +* target-definition – a set of required bundles that are dependencies of the APIs and Eclipse Kura. + + ![Import Project](./images/development-environment-setup/image6.png) + +Eclipse will also report some errors at this point. See the next section to resolve those errors. + +### Workspace Setup +This section will guide the users to configure the development workspace environment. + +#### JRE Configuration +The latest Eclipse IDEs require and configure, by default, a Java 11 environment. +In order to be able to leverage and develop using the new workspace for Eclipse Kura, the user will be required to perform a one-time operation to specify to the IDE a Java 8 JDK. +Opening the Eclipse preferences and selecting the Installed JREs in the Java section, the user has to select an installed Java 8 instance. + +![Set JDK 8](./images/development-environment-setup/image7.png) + +After applying the configuration change, the user will be prompted to align also the compiler options. To do so, selecting the Compiler entry in the Java section, the user has to select 1.8 from the list of available Java versions. + +![Set Compiler 8](./images/development-environment-setup/image8.png) + +After applying the changes, the user will be prompted to recompile the environment. + +#### Target Definition Setup +Click the arrow next to the **target-definition** project in the workspace and double-click **kura-equinox_.target** to open it. + +![Target Definition Setup](./images/development-environment-setup/image9.png) + +In the Target Definition window, click the link **Set as Target Platform**. Doing so will reset the target platform, rebuild the Eclipse Kura projects, and clear the errors that were reported. At this point, you are ready to begin developing Eclipse Kura-based applications for your target platform. + +#### Run the Eclipse Kura Emulator + +To start the Eclipse Kura emulator, select the "Eclipse Kura Emulator.launch" profile from "Other Projects" -> "setups" -> "launchers" and open it with "Run as" -> "Run Configurations...". Then click on the "Arguments" tab and update the "VM arguments" as follows to adapt the paths to the folder structure created by the Oomph installer: + +``` shell +-Dkura.have.net.admin=false -Dorg.osgi.framework.storage=/tmp/osgi/framework_storage -Dosgi.clean=true -Dosgi.noShutdown=true -Declipse.ignoreApp=true -Dorg.eclipse.kura.mode=emulator -Dkura.configuration=file:${workspace_loc}/../git/kura/kura/emulator/org.eclipse.kura.emulator/src/main/resources/kura.properties -Ddpa.configuration=/tmp/kura/dpa.properties -Dlog4j.configurationFile=file:${workspace_loc}/../git/kura/kura/emulator/org.eclipse.kura.emulator/src/main/resources/log4j.xml -Dkura.data=${workspace_loc}/kura/data -Dkura.snapshots=${workspace_loc}/kura/user/snapshots -Dorg.eclipse.equinox.http.jetty.customizer.class=org.eclipse.kura.jetty.customizer.KuraJettyCustomizer +``` + +![Vm arguments](./images/development-environment-setup/image12.png) + +The Eclipse Kura Web UI will be available at the following URL: http://127.0.0.1:8080 with username and password **admin**. diff --git a/mkdocs.yml b/mkdocs.yml index e238a519663..5bb8016f522 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -119,7 +119,8 @@ nav: - Wire Service V1 REST APIs and MQTT Request Handler: kura-wires/wire-service-rest-v1.md - References: kura-wires/wire-service-references.md - Java Application Development: - - Development Environment Setup: java-application-development/development-environment-setup.md + - Kura Development Environment Setup: java-application-development/development-environment-setup.md + - Add-ons Development Environment Setup: java-application-development/kura-workspace-setup.md - Hello World Application: java-application-development/hello-world-application.md - Deploy and Debug Applications: java-application-development/deploy-and-debug-applications.md - Remote Debugging on Target Platform: java-application-development/remote-debugging-on-target-platform.md