第 10 章 为 Karaf 镜像开发应用


本教程介绍了如何为 Karaf 镜像创建和部署应用。

10.1. 使用 Maven Archetype 创建 Karaf 项目

要使用 Maven archetype 创建 Karaf 项目,请按照以下步骤操作:

流程

  1. 进入您系统上的相应目录。
  2. 启动 Maven 命令以创建 Karaf 项目

    mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate \
      -DarchetypeCatalog=https://maven.repository.redhat.com/ga/io/fabric8/archetypes/archetypes-catalog/2.2.0.fuse-740017-redhat-00003/archetypes-catalog-2.2.0.fuse-740017-redhat-00003-archetype-catalog.xml \
      -DarchetypeGroupId=org.jboss.fuse.fis.archetypes \
      -DarchetypeArtifactId=karaf-camel-log-archetype \
      -DarchetypeVersion=2.2.0.fuse-740017-redhat-00003
    Copy to Clipboard Toggle word wrap
  3. archetype 插件切换到交互模式以提示您输入剩余的字段

    Define value for property 'groupId': : org.example.fis
    Define value for property 'artifactId': : fuse74-karaf-camel-log
    Define value for property 'version':  1.0-SNAPSHOT: :
    Define value for property 'package':  org.example.fis: :
    Confirm properties configuration:
    groupId: org.example.fis
    artifactId: fuse74-karaf-camel-log
    version: 1.0-SNAPSHOT
    package: org.example.fis
     Y: :
    Copy to Clipboard Toggle word wrap

    出现提示时,为 groupId 值输入 org.example.fis,为 artifactId 值输入 fuse74-karaf-camel-log。接受剩余的字段的默认值。

  4. 按照快速启动中的说明,了解如何构建和部署示例。
注意

有关 available Karaf archetypes 的完整列表,请参阅 Karaf Archetype Catalog

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat