本文介绍了Maven构建错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写完

mvn -f pom.xml compile exec:java -Dexec.classpathScope=Compile-Dexec.main Class=storm.starter.WordCountTopology

发现了这个!

[0]在插件"exec-maven-plugin"的定义内指定 以下:

[0] Inside the definition for plugin 'exec-maven-plugin' specify the following:

...值

-或-

在命令行上,指定:'-Dstorm.topology = VALUE

on the command line, specify: '-Dstorm.topology=VALUE

推荐答案

如果您链接pom.xml,那么这会更容易.我猜您正在使用暴风雨.您是否编写了自己的topologyClass?来自文档:

If you link your pom.xml then this would be easier. I'm guessing you're using Storm. Have you written your own topologyClass? From the documentation:

拓扑驱动程序的类名(例如"com.foo.bar.MyTopology") 命令行覆盖:-Dmaven.storm.topology =

The class name of the topology driver (e.g. "com.foo.bar.MyTopology") Command line override: -Dmaven.storm.topology=

该文档还为您提供了pom的代码,但您可能希望像这样将exec-maven-plugin添加到pom.xml中:

The documentation also gives you the code for your pom but you might want to add exec-maven-plugin to your pom.xml like so:

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <configuration>
                <mainClass>com.domain.yourApp</mainClass>
            </configuration>
        </plugin>
    </plugins>
</build>

需要注意的一件事: 您需要更改mainClass以匹配项目中包含要执行的主要方法的类.

One thing to note: you need to alter mainClass to match the class in your project that contains the main method you want to execute.

然后您就可以运行mvn exec:java.

这篇关于Maven构建错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 11:52