Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
karaf-maven-example-assembly [KARAF-6069] Avoid to overwrite project artifact if the packaging is pom Jan 7, 2019
karaf-maven-example-client
karaf-maven-example-deploy
karaf-maven-example-kar [KARAF-6069] Avoid to overwrite project artifact if the packaging is pom Jan 7, 2019
karaf-maven-example-run-bundle
karaf-maven-example-run Update version to 4.3.0-SNAPSHOT Feb 11, 2019
README.md [KARAF-2511] Add examples module Aug 17, 2018
pom.xml Update version to 4.3.0-SNAPSHOT Feb 11, 2019

README.md

Apache Karaf Maven example

Abstract

This example provides several Maven module showing usage of Karaf Maven plugin.

Each module uses a specific goal of the Karaf Maven plugin, covering different use cases.

Maven Modules

  • karaf-maven-example-run uses the karaf-maven-plugin:run goal to download and start a Karaf instance.
  • karaf-maven-example-run-bundle uses the karaf-maven-plugin:run goal to download, start a Karaf instance and deploy the project bundle in this running instance.
  • karaf-maven-example-deploy uses the karaf-maven-plugin:deploy goal to deploy the module artifact into a Karaf instance (remote for example).
  • karaf-maven-example-client uses the karaf-maven-plugin:client goal to execute a shell command on a running Karaf instance.
  • karaf-maven-example-kar packages a features repository as a kar file, ready to be deployed.
  • karaf-maven-example-assembly uses the karaf-maven-plugin to create a Karaf distribution.

Goals Execution

Run

The karaf-maven-example-run example downloads and starts a Apache Karaf container via Maven. By default, we just start and stop the instance (<keepRunning>false</keepRunning>), but you can leave the instance running using <keepRunning>true</keepRunning>.

Simply do:

mvn clean install

Run & Deploy

The karaf-maven-example-run-bundle example is similar to the karaf-maven-example-run adding the deployment on the current project bundle in the running instance.

The Karaf plugin is able to use the project artifact (jar, bundle, feature, whatever) when using <deployProjectArtifact>true</deployProjectArtifact>. It will automatically try to deploy the module artifact into the running Karaf instance.

Simply do:

mvn clean install

Deploy

The karaf-maven-example-deploy example expects a Apache Karaf instance running locally on your machine. Then, it will automatically deploy the project artifact to this running instance (when <useProjectArtifact/> configuration is true, which is the default).

By default, it uses SSH, but you can use JMX instead (using <useSsh>false</useSsh> configuration).

It's also possible to deploy additional artifacts using <artifactLocations/> configuration.

Simply do:

mvn clean install

Client

The karaf-maven-example-client example allows you to execute some shell commands on a running Karaf instance (using SSH) directly from Maven.

It allows you to install features, change configuration or whatever, and get the output within Maven.

It's possible to execute commands (specified with <commands/> configuration) and/or scripts (specified with <scripts/> configuration).

Simply do:

mvn clean install

KAR

The karaf-maven-example-kar example shows how to create a KAR file containing project artifact.

Simply do:

mvn clean install

Assembly

The karaf-maven-example-assembly example shows how to create your own Karaf distribution easily.

Simply do:

mvn clean install
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.