Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve "Command line build" section #8767

Merged
merged 1 commit into from
Oct 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,32 @@ To build all add-ons from the command-line, type in:

`mvn clean install`

Optionally you can skip tests (`-DskipTests`) or skip some static analysis (`-DskipChecks`).
This does improve the build time but could hide problems in your code.
For binding development you want to run that command without skipping checks and tests.
To check if your code is following the [code style](https://www.openhab.org/docs/developer/guidelines.html#b-code-formatting-rules-style) run `mvn spotless:check`.
If Maven prints `[INFO] Spotless check skipped` then run `mvn spotless:check -Dspotless.check.skip=false` instead as the check is not mandatory yet.
To reformat you code run `mvn spotless:apply`.
To improve build times you can add the following options to the command:

Subsequent calls can include the `-o` for offline as in: `mvn clean install -DskipChecks -o` which will be a bit faster.
| Option | Description |
| ----------------------------- | --------------------------------------------------- |
| `-DskipChecks` | Skip the static analysis (Checkstyle, FindBugs) |
| `-DskipTests` | Skip the execution of tests |
| `-Dmaven.test.skip=true` | Skip the compilation and execution of tests |
| `-Dfeatures.verify.skip=true` | Skip the Karaf feature verification |
| `-Dspotless.check.skip=true` | Skip the Spotless code style checks |
| `-o` | Work offline so Maven does not download any updates |
| `-T 1C` | Build in parallel, using 1 thread per core |

For integration tests you might need to run: `mvn clean install -DwithResolver -DskipChecks`
For example you can skip checks and tests during development with:

You find a generated `.jar` file per bundle in the respective bundle `/target` directory.
`mvn clean install -DskipChecks -DskipTests`

Adding these options improves the build time but could hide problems in your code.
Parallel builds are also less easy to debug and the increased load may cause timing sensitive tests to fail.

To check if your code is following the [code style](https://www.openhab.org/docs/developer/guidelines.html#b-code-formatting-rules-style) run: `mvn spotless:check`
To reformat your code so it conforms to the code style you can run: `mvn spotless:apply`

When your add-on also has an integration test in the `itests` directory, you may need to update the runbundles in the `itest.bndrun` file when the Maven dependencies change.
Maven can resolve the integration test dependencies automatically by executing: `mvn clean install -DwithResolver -DskipChecks`

The build generates a `.jar` file per bundle in the respective bundle `/target` directory.

### How to develop via an Integrated Development Environment (IDE)

Expand Down