Java 无法执行目标 org.codehaus.mojo:exec-maven-plugin:1.2.1 - kafka 风暴集成
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20492582/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1 - kafka storm integration
提问by user2728024
I am working on kafka strom integration. Im stuck with an error. The Build Fails when I try to Run it usingmvn -e -f m2-pom.xml compile exec:java -Dexec.classpathScope=compile -Dexec.mainClass=storm.starter.MainTopology
我正在研究 kafka strom 集成。我被一个错误困住了。当我尝试使用运行它时构建失败mvn -e -f m2-pom.xml compile exec:java -Dexec.classpathScope=compile -Dexec.mainClass=storm.starter.MainTopology
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java
(default-cli) on project storm-starter: The parameters 'mainClass' for goal
org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid
This is a snippet of the pom.xml file:
这是 pom.xml 文件的片段:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<classpathScope>compile</classpathScope>
<mainClass>${storm.topology}</mainClass>
</configuration>
</plugin>
I tried
我试过
rm -rf ~/.m2/
mvn clean install
I am using storm-0.9.0-rc3 and kafka-0.7.2
我正在使用 Storm-0.9.0-rc3 和 kafka-0.7.2
采纳答案by jvwilge
The element mainClass is empty because the property storm.topology has no value, this is why you get an error.
元素 mainClass 是空的,因为属性 Storm.topology 没有值,这就是你得到错误的原因。
You have to pass the storm.topology parameter instead of mainClass :
您必须传递 Storm.topology 参数而不是 mainClass :
mvn -e -f m2-pom.xml compile exec:java -Dstorm.topology=storm.starter.MainTopology
See the Maven section of the readme of this example for more information: https://github.com/nathanmarz/storm-starter
有关更多信息,请参阅本示例自述文件的 Maven 部分:https: //github.com/nathanmarz/storm-starter
回答by user2720864
Could you please try adding this line
你能试试添加这一行吗
<execution>
<phase>package</phase> <!-- Add this -->
<goals>
.....
.....