This project is a simple tool to generate Eclipse IDE metadata for Kura projects. Its main goal is to provide a simple to use solution to generate the metadata files required by VSCode to provide code completion and validation for Kura projects.
To use this tool, you need to have Python 3 installed in your system. You can download it from the official website.
After installing Python, you can download the latest release of this tool from the releases page. Simply install the tool by running the following command:
pip3 install metadata_generator-<version>.whlusage: kura-gen [-h] [-d] [--dry-run] [-t TARGET_PLATFORM] [--patch-target-platform]
Kura projects metadata generator
options:
-h, --help show this help message and exit
-d, --debug Print debug information
--dry-run Dry run. Do not write any files to disk
-t, --target-platform TARGET_PLATFORM
Path to the target platform file
--patch-target-platform
Patch the target platform file with the correct pathsNote
The --patch-target-platform option is used to substitute the ${git_work_tree} variable in the target platform file with the path of the git repository root. This is only needed for the Kura repository.
To generate the metadata files, you need to change the current working directory to the root directory of your Kura project. You can do this by running the following command:
Important
A successfull maven build is required before running the metadata generator.
cd /path/to/your/kura/projectAfter changing the working directory, you can run the following command to generate the metadata files:
kura-genThe tool will generate the following files:
javaConfig.jsonat the root of the project. This config file is used to tell the PDE extension about the locations of the sub projects and target platform file..projectfile in each sub project. This file is used by Eclipse to identify the project type and dependencies..classpathfile in each sub project. This file is used by Eclipse to identify the classpath of the project.- if the
--patch-target-platformoption is used the script will also update the target platform file with the correct paths (i.e. substitute the${git_work_tree}variable with the path of the git repository root).
After generating the metadata files, you can open the project in VSCode and install the required extensions. The following extensions are required to provide code completion and validation for Kura projects:
- Eclipse PDE support for VS Code
- Language Support for Java by Red Hat
- Debugger for Java
- Java Test Runner
Here follows an example of how to setup a project in VSCode using the metadata generator:
- Clone the project repository
git clone https://github.com/my-awesome-kura-project.git && cd my-awesome-kura-project- Build the project
mvn clean install- Generate the metadata files (assuming the
kura-gentool is installed)
kura-gen- Open the project in VSCode
code .-
Install the required extensions
-
...and you're done!
Take a look at the official documentation here
uv run generator.pyuv build