You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When executing mvn clean compile exec:java, following error occurs:
[INFO] --- exec-maven-plugin:3.1.0:java (default-cli) @ package-visibility ---
[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:283)
at java.lang.Thread.run (Thread.java:833)
Caused by: java.lang.IllegalAccessException: symbolic reference class is not accessible: class Main, from class org.codehaus.mojo.exec.ExecJavaMojo$1 (unnamed module @4425dfee)
at java.lang.invoke.MemberName.makeAccessException (MemberName.java:955)
at java.lang.invoke.MethodHandles$Lookup.checkSymbolicClass (MethodHandles.java:3686)
at java.lang.invoke.MethodHandles$Lookup.resolveOrFail (MethodHandles.java:3646)
at java.lang.invoke.MethodHandles$Lookup.findStatic (MethodHandles.java:2588)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:276)
at java.lang.Thread.run (Thread.java:833)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.152 s
[INFO] Finished at: 2022-09-01T23:19:46+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project package-visibility: An exception occurred while executing the Java class. The specified mainClass doesn't contain a main method with appropriate signature.: symbolic reference class is not accessible: class Main, from class org.codehaus.mojo.exec.ExecJavaMojo$1 (unnamed module @4425dfee) -> [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
On the other hand, java src/main/java/Main.java command does well.
This is likely a regression, it works with v1.5.0. Probably due to using MethodHandles.publicLookup() in #119. Having main in a package-private visible class is valid.
When executing
mvn clean compile exec:java
, following error occurs:On the other hand,
java src/main/java/Main.java
command does well.I think a main class doesn't need to be public.
RESOURCES
src/main/java/Main.java
:pom.xml
:The text was updated successfully, but these errors were encountered: