0

When I try to compile my code on the horton works sandbox with:

mvn compile exec:java -Dstorm.topology=ProvaTopology.java -e

And my pom.xml is:

<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>

  <groupId>Storm.practice</groupId>
  <artifactId>Storm.Prova</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>Storm.Prova</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
  <dependency>
    <groupId>org.apache.storm</groupId>
    <artifactId>storm-core</artifactId>
    <version>0.9.1-incubating</version>
    </dependency>
  <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

So when I try the compilation I have some errors on it, it shows something like this:

[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Storm.Prova 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Storm.Prova ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/prova/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ Storm.Prova ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ Storm.Prova ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.227s
[INFO] Finished at: Thu Nov 05 17:48:55 UTC 2015
[INFO] Final Memory: 11M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project Storm.Prova: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java are missing or invalid -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project Storm.Prova: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java are missing or invalid
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:220)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginParameterException: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java are missing or invalid
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:581)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:534)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:97)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
[ERROR] 
[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

I'm using Eclipse Mars Web with M2E plugin, and the recommended version of maven for the hortonworks sandbox.

If anyone knows why it's showing this error, please tell me.

Thanks in advance!

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137
Amnor
  • 380
  • 6
  • 21

1 Answers1

2

From the error message it seems like your maven plugin can't find your main class. What if you give the full package name of your main class? Something like

-Dstorm.topology=com.xyz.wbx.ProvaTopology

Replace with whatever your actual package name is when attempting to compile your project.

EDIT

Your error message says that exec-maven-plugin couldn't find the main class. Your pom doesn't seem to have that listed as a plugin. Based on this answer, include the following in your pom. Include it right after the dependencies tag.

<build>
  <plugins>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
        <executions>
            <execution>
                <goals>
                    <goal>java</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <mainClass>com.xyz.wbx.ProvaTopology</mainClass>
        </configuration>
        </plugin>
  </plugins>
</build>

For the full package name, don't include src.main.java, just start with the domain. Which is usually com,org,etc.

Community
  • 1
  • 1
Morgan Kenyon
  • 3,072
  • 1
  • 26
  • 38
  • Thanks, I've tried with complete package and complete route from de parent project directory (src.main,java..) and doesn't work, same message. (sorry about the other text, control+c mistake) – Amnor Nov 05 '15 at 18:17
  • How are you getting the exec-maven-plugin? Your pom.xml doesn't say that you have it. – Morgan Kenyon Nov 05 '15 at 18:21
  • I don't really know what you mean, this pom was a sample from a web and edited for using my projet, maybe it's missing that part. Sorry I'm a complete noob using maven. I've got this from -X(debug) option, maybe useful:[DEBUG] (f) arguments = [] [DEBUG] (f) classpathScope = runtime – Amnor Nov 05 '15 at 18:25
  • Check my updated answer. Could you also update your pom.xml if my suggestion doesn't work so I can see what state your pom.xml is in? – Morgan Kenyon Nov 05 '15 at 18:30
  • i'm on it, i'll tell you the results in a moment, thanks – Amnor Nov 05 '15 at 18:33
  • It's working now! thanks a lot! now the failures are from my code ^^ but no more maven errors on it! Again, thank you! – Amnor Nov 05 '15 at 18:40
  • You're welcome. I'm glad to help. An accepted answer and/or an upvote would be appreciated as well. – Morgan Kenyon Nov 05 '15 at 18:40