使用Maven构建风暴启动器

时间:2014-05-26 16:27:39

标签: java maven build apache-storm

我按照风暴启动程序中的步骤进行操作,并尝试使用命令“mvn compile exec:java -Dstorm.topology = storm.starter.WordCountTopology”从storm-starter构建项目。但是给出了以下错误。任何人都能告诉我它为什么会发生以及我需要做些什么才能解决这个问题?

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.017 s
[INFO] Finished at: 2014-05-26T11:23:54-06:00
[INFO] Final Memory: 20M/159M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3:java (default-cli) on project storm: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.3:java are missing or invalid -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException

3 个答案:

答案 0 :(得分:1)

你需要像这样运行它:

mvn exec:java -Dexec.mainClass="com.example.Main" [-Dexec.args="argument1"] ...

usage page

中阅读更多内容

答案 1 :(得分:1)

我遇到了同样的问题。经过一些试验和错误,这有效:

mvn -X compile exec:java -Dstorm.topology=storm.starter.WordCountTopology -Dexec.mainClass="WordCountTopology"

答案 2 :(得分:1)

我有同样的问题,解决它很简单: 在执行风暴启动教程中给出的mvn命令之前,您必须转到storm-starter目录。

cd examples/storm-starter/
mvn compile exec:java -Dstorm.topology=storm.starter.WordCountTopology