検索

このコンテンツは選択した言語では利用できません。

Appendix B. Karaf Maven Plug-In

download PDF

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 the system/ 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 the system/ 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 more library child elements that specify a library URL. For example:

<libraries>
    <library>mvn:org.postgresql/postgresql/9.3-1102-jdbc41;type:=endorsed</library>
</libraries>
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.