Maven构建storm

本文指导如何通过Maven将Storm jar包引入项目类路径,包括配置pom.xml文件以作为开发依赖,以及如何使用Leiningen作为纯Java项目的构建工具。此外,还介绍了如何将Storm作为库使用,以及开发Storm项目时的注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

To develop topologies, you'll need the Storm jars on your classpath. You should either include the unpacked jars in the classpath for your project or use Maven to include Storm as a development dependency. Storm is hosted on Clojars (a Maven repository). To include Storm in your project as a development dependency, add the following to your pom.xml:

<repository>
  <id>clojars.org</id>
  <url>http://clojars.org/repo</url>
</repository>
<dependency>
  <groupId>storm</groupId>
  <artifactId>storm</artifactId>
  <version>0.7.2</version>
  <scope>test</scope>
</dependency>

Here's an example of a pom.xml for a Storm project.

If Maven isn't your thing, check out leiningen. Leiningen is a build tool for Clojure, but it can be used for pure Java projects as well. Leiningen makes builds and dependency management using Maven dead-simple. Here's an example project.clj for a pure-Java Storm project:

(defproject storm-starter "0.0.1-SNAPSHOT"
  :java-source-path "src/jvm"
  :javac-options {:debug "true" :fork "true"}
  :jvm-opts ["-Djava.library.path=/usr/local/lib:/opt/local/lib:/usr/lib"]
  :dependencies []
  :dev-dependencies [
                     [storm "0.7.2"]
                     ])

You can fetch dependencies using lein deps, build the project with lein compile, and make a jar suitable for submitting to a cluster withlein uberjar.

Using Storm as a library

If you want to use Storm as a library (e.g., use the Distributed RPC client) and have the Storm dependency jars be distributed with your application, there's a separate Maven dependency called "storm/storm-lib". The only difference between this dependency and the usual "storm/storm" is that storm-lib does not have any logging configured.

Developing Storm

You will want to

bash ./bin/install_zmq.sh   # install the jzmq dependency
lein sub install

Build javadocs with

bash ./bin/javadoc.sh

Building a Storm Release

Use the file bin/build_release.sh to make a zipfile like the ones you would download (and like what the bin files require in order to run daemons).

come from sorm 's wiki

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值