Skip to content

Commit d802bba

Browse files
docs: update archetype documentation
Signed-off-by: Marcello Rinaldo Martina <martina.marcello.rinaldo@outlook.com>
1 parent ec77ff3 commit d802bba

3 files changed

Lines changed: 28 additions & 16 deletions

File tree

193 KB
Loading
492 KB
Loading

docs/java-application-development/kura-addon-archetype.md

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,23 @@ mvn archetype:generate \
2929
-DarchetypeVersion="<kura-version>"
3030
```
3131

32-
The command will start the generation of the archetype in interactive mode. Maven will ask for a few parameters on the command line:
32+
The command will start the generation of the archetype in interactive mode.
3333

34-
- **groupId** : the Maven group id of the generated pom files, usually `org.eclipse.kura`
35-
- **artifactId**: the Maven artifact id of the generated parent pom file and the name of the generated top level project folder, usually something like `org.eclipse.kura.myartifact`
36-
- **package**: the Java package to be used for the main bundle, usually something like `org.eclipse.kura.myartifact`
34+
![](./images/kura-addon-archetype/archetype-generate.png)
35+
36+
Maven will ask for a few parameters on the command line:
37+
38+
- **groupId** : the Maven group id of the generated POM files
39+
- **artifactId**: the Maven artifact id of the generated parent pom file, and the name of the generated top level project folder
40+
- **package**: the base Java package and the main artifact of the project
41+
42+
The official Kura addons naming rule is:
43+
44+
- **groupId** = `org.eclipse.kura`
45+
- **artifactId** = repository name: `kura-<feature>` (e.g. `kura-wires`)
46+
- **package** = `org.eclipse.kura.<feature>` (e.g. `org.eclipse.kura.wires`)
47+
48+
**It is not allowed to generate a project with artifactId = package**.
3749

3850
The following optional parameters can be changed by answering `n` after the `Confirm properties configuration` prompt, which appears after editing the properties above:
3951

@@ -49,29 +61,23 @@ The project _requires_ source control management via `git` to correctly build. T
4961

5062
```bash
5163
git init
52-
```
53-
54-
```bash
5564
git add .
56-
```
57-
58-
```bash
5965
git commit -m "initial commit"
6066
```
6167

6268
Once this steps are completed you can safely build the project.
6369

6470
## Project structure
6571

66-
At the end of the procedure, the archetype will generate a subfolder in the working directory containing the following subfolders:
67-
68-
- **bundles**: the directory where developed bundles can be placed. After the first archetype execution, this directory contains a single project, named as `artifactId.bundle`
72+
At the end of the procedure, the generated project is organized as follows:
6973

70-
- **distrib**: contains a project that builds a DEB package that installs the JAR produced in `bundles` in Kura's plugins folder `/opt/eclipse/kura/plugins`. It is recommended to configure this project to customize the target package architecture and other parameters. The project code is commented with hints on the configurable options
74+
![](./images/kura-addon-archetype/project-structure.png)
7175

72-
- **target-definition**: The `.target` file contained in the project is the way to specify the project dependencies as maven artifacts, Tycho will then wrap them as bundles and make them available in the target platform. Since only released artifacts are published on Maven central, it is recommeded to perform a local Kura build to have the SNAPSHOT versions available
76+
- **parent**: the main reactor project. It aggregates this project’s OSGi bundles, integration and unit tests, and the target platform definition. Immediately after generation, it includes a single OSGi bundle named after the `{package}` value (for example, `org.eclipse.kura.myfeature`)
77+
- **target-definition**: contains the `.target` file that defines the target platform dependencies. Dependencies are declared as Maven artifacts; Tycho then wraps them as OSGi bundles and adds them to the target platform. Because Maven Central only hosts released artifacts, it is recommended to build Kura locally if you need *-SNAPSHOT* dependencies
78+
- **tests**: contains OSGi integration tests executed via the `tycho-surefire-plugin`
7379

74-
- **tests**: contains OSGi integration tests executed by the `tycho-surefire-plugin`
80+
- **distrib**: a packaging project that builds a Debian (`.deb`) package. The package installs the JAR produced by the bundles into Kura’s plugins directory at `/opt/eclipse/kura/plugins`. You should review and adjust this project to match your target architecture and packaging requirements; the source is annotated with comments indicating the main configuration points
7581

7682
## Compile and run
7783

@@ -124,6 +130,12 @@ Example:
124130
mvn clean install -Dpackage.revision=6 -DreleaseBuild
125131
```
126132

133+
### Deploy artifacts
134+
135+
As default, the `distrib` project and the projects under `parent` are not deployed (they are configured to skip the execution of the `maven-deploy-plugin`). Only the BOM POM (the root `pom.xml`) and the single OSGi bundles are meant to be deployed.
136+
137+
Please add the proper `maven-deploy-plugin` configuration for the bundles that need to be deployed. See the archetype's generated bundle for details.
138+
127139
## IDE setup
128140

129141
We officially support two IDEs for developing Kura Addons: **Eclipse IDE** and **Visual Studio Code**. The following sections describe how to set up the projects in these IDEs.

0 commit comments

Comments
 (0)