このコンテンツは選択した言語では利用できません。
Appendix B. Karaf Maven Plug-In
B.1. Using the karaf-maven-plugin
The karaf-maven-plugin
enables you to create a Karaf server assembly, which is a microservices style packaging of a Karaf container. That is, the finished assembly contains all of the essential components of a Karaf installation (for example, including the contents of the etc/
, data/
, lib
, and system
directories), but stripped down to the bare minimum required to run your application.
B.2. Karaf Maven Plug-In Goals
The following Karaf Maven plug-in goals are relevant to building server assemblies in Fuse on OpenShift:
B.2.1. karaf:assembly Goal
The recommended way to create a Karaf server assembly is to use the karaf:assembly
goal provided by the karaf-maven-plugin
. This assembles a server from the Maven dependencies in the project pom.
B.2.1.1. Example of a Maven Assembly
You can create a Karaf server assembly using the karaf:assembly
goal provided by the karaf-maven-plugin
. This goal assembles a microservices style server assembly from the Maven dependencies in the project POM. In a Fuse on OpenShift project, it is recommended that you bind the karaf:assembly
goal to the Maven install
phase. The project uses bundle
packaging and the project itself gets installed into the Karaf container by listing it inside the startupBundles
element. The following example displays the typical Maven configuration in a quickstart:
<plugin> <groupId>org.jboss.redhat-fuse</groupId> <artifactId>karaf-maven-plugin</artifactId> <version>${fuse.version}</version> <extensions>true</extensions> <executions> <execution> <id>karaf-assembly</id> <goals> <goal>assembly</goal> </goals> <phase>install</phase> </execution> </executions> <configuration> <!-- we are using karaf 2.4.x --> <karafVersion>v24</karafVersion> <useReferenceUrls>true</useReferenceUrls> <archiveTarGz>false</archiveTarGz> <includeBuildOutputDirectory>false</includeBuildOutputDirectory> <startupFeatures> <feature>karaf-framework</feature> <feature>shell</feature> <feature>jaas</feature> <feature>aries-blueprint</feature> <feature>camel-blueprint</feature> <feature>fabric8-karaf-blueprint</feature> <feature>fabric8-karaf-checks</feature> </startupFeatures> <startupBundles> <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle> </startupBundles> </configuration> </plugin>
B.2.1.2. Parameters
The karaf:assembly
goal supports the following parameters:
startupFeature
-
This will result in the feature bundles being listed in
startup.properties
at the appropriate start level and the bundles being copied into thesystem/
internal repository. You can use<feature-name>
or<feature-name>/<feature-version>
formats. bootFeature
-
This will result in the feature name being added to
boot-features
in the features service configuration file and all the bundles in the feature copied into thesystem/
internal repository. You can use<feature-name>
or<feature-name>/<feature-version>
formats. installedFeature
-
This will result in all the bundles in the feature being installed in the
system/
internal repository. Therefore, at run time the feature may be installed without access to external repositories. You can use<feature-name>
or<feature-name>/<feature-version>
formats. libraries
The plugin accepts the
libraries
element, which can have one or morelibrary
child elements that specify a library URL. For example:<libraries> <library>mvn:org.postgresql/postgresql/9.3-1102-jdbc41;type:=endorsed</library> </libraries>