当我在 ~/storm/examples/fyp-storm-try/ 目录中运行 sudo mvn exec:java -Dstorm.topology=fyp-storm-try.src.jvm.Topology 时,我遇到了关于执行时发生异常的错误Java类,如何解决问题?
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.838s
[INFO] Finished at: Sun Apr 05 09:09:28 UTC 2015
[INFO] Final Memory: 9M/22M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project fyp-storm-try: An exception occured while executing the Java class. fyp-storm-try.src.jvm.Topology -> [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/MojoExecutionException
下面是我的 pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>storm</artifactId>
<groupId>org.apache.storm</groupId>
<version>0.9.4</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>org.apache.storm</groupId>
<artifactId>fyp-storm-try</artifactId>
<packaging>jar</packaging>
<name>fyp-storm-try</name>
......跳过某些部分......
<build>
<sourceDirectory>src/jvm</sourceDirectory>
<testSourceDirectory>test/jvm</testSourceDirectory>
<resources>
<resource>
<directory>${basedir}/multilang</directory>
</resource>
</resources>
<plugins>
......跳过某些部分......这是 pom.xml 的最后一部分
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass />
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
但是,当我在 ~/storm/examples/fyp-storm-try/ 使用命令 sudo mvn -e exec:java 运行时
出现以下错误:
[错误] 无法在项目 fyp-storm-try 上执行目标 org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli):目标 org.codehaus.mojo 的参数“mainClass”: exec-maven-plugin:1.2.1:java is missing or invalid -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1 :项目 fyp-storm-try 上的 java (default-cli):目标 org.codehaus.mojo:exec-maven-plugin:1.2.1:java 的参数“mainClass”丢失或无效
......跳过某些部分......
[错误] [帮助 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException