Camel 开发者控制台

Camel Maven 原型

师成师成· 更新于 2026-09-28· 阅读 5 分钟· 0 次阅读

登录后可跨设备保存划线和私人笔记登录

Camel Maven 原型

Camel 为 Maven 最终用户提供了以下原型。

支持的原型

原型说明
camel-archetype-api-component该原型用于为 Camel 组件创建新的 Maven 项目。如果 Camel 中缺少某个 API 组件而你想自行创建,则可使用它。
camel-archetype-component该原型用于为 Camel 组件创建新的 Maven 项目。如果 Camel 中缺少某个组件而你想自行创建,则可使用它。
camel-archetype-dataformat该原型用于为 Camel 数据格式创建新的 Maven 项目。如果 Camel 中缺少某种数据格式而你想自行创建,则可使用它。
camel-archetype-java该原型用于创建使用 Java DSL 编写 Camel 路由的新 Maven 项目。
camel-archetype-main该原型用于创建运行独立 Camel(camel-main)的 Camel 路由的新 Maven 项目。
camel-archetype-spring-boot该原型用于创建使用 Spring Boot 的 Camel 路由的新 Maven 项目。

这些原型的 Maven 坐标如下:

<dependency>
  <groupId>org.apache.camel.archetypes</groupId>
  <artifactId>${archetype-name}</artifactId>
  <version>${camel-version}</version>
</dependency>

Snapshot 原型

如果你想使用尚未发布的 Camel 版本中的原型,只需告诉 maven-archetype-plugin 到哪里去找它即可。例如,假设有人想基于 Camel 4.23.0-SNAPSHOT 创建一个 Java 项目,他需要使用以下命令

mvn archetype:generate \
  -DarchetypeGroupId=org.apache.camel.archetypes \
  -DarchetypeArtifactId=camel-archetype-java \
  -DarchetypeVersion=4.23.0-SNAPSHOT

项目创建后,你可能需要向 pom.xml 文件中添加另一个仓库,以便加载 camel-maven-plugin 的 SNAPSHOT 版本。

<pluginRepositories>
  <pluginRepository>
    <releases>
      <enabled>false</enabled>
    </releases>
    <snapshots/>
    <id>Apache Snapshot Repository</id>
    <url>http://repository.apache.org/snapshots</url>
  </pluginRepository>
</pluginRepositories>

评论

登录后参与评论

正在加载评论…