Skip to content

The specified mainClass doesn't contain a main method with appropriate signature. #5

@0x333333

Description

@0x333333

Hi there,

When I ran "mvn compiule exec:java" I got this error:

mvn compile exec:java
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building getting-started 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ storage-java-blob ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ storage-java-blob ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 6 source files to D:\tools\log\storage-blob-java-getting-started\target\classes
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ storage-java-blob ---
[WARNING]
java.lang.Exception: The specified mainClass doesn't contain a main method with appropriate signature.
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodException: BlobBasics.main([Ljava.lang.String;)
        at java.lang.Class.getMethod(Class.java:1786)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:281)
        ... 1 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.465 s
[INFO] Finished at: 2016-09-05T17:40:45+08:00
[INFO] Final Memory: 15M/215M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project storage-java-blob: An exception occured while executing the Java class. The specified mainClass doesn't contain a main method with appropriate signature. BlobBasics.main([Ljava.lang.String;) -> [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

According to error, I modified pom.xml and replaced BlobBasics with Main, because I found that only Main contains a main function. Am I right?

Thanks,
Zhipeng

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions