Search code examples
javaclassnotfoundexceptionjvm-argumentsmainclass

How to resolve jenkins maven error 'Could not find main class'?


Jenkins fails running maven at all with

Parsing POMs
[workspace] $ java -Xmx1500m or -XX:MaxPermSize=250m -cp C:\dev\tools\jenkins\jenkins1.550\plugins\maven-plugin\WEB-INF\lib\maven3-agent-1.4.jar;C:\dev\tools\apache-maven-3.0.4\boot\plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main C:\dev\tools\apache-maven-3.0.4 C:\Windows\Temp\jetty-0.0.0.0-8585-jenkins.war--any-\webapp\WEB-INF\lib\remoting-2.33.jar C:\dev\tools\jenkins\jenkins1.550\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-1.4.jar C:\dev\tools\jenkins\jenkins1.550\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.4.jar 55906
Fehler: Hauptklasse or konnte nicht gefunden oder geladen werden
ERROR: Failed to launch Maven. Exit code = 1
Finished: FAILURE

How can I change configuration to have english output? The translated error message is "Could not find or load main class".

I have read that M2_HOME needs to be set correctly, but I think that's the case:

echo %M2_HOME%
C:\dev\tools\apache-maven-3.0.4

I don't know if that is important for that error, but JAVA_HOME is set, too.

Is there something like a verbose mode for jenkins?


Solution

  • Hauptklasse or: this means MainClass with the name 'or' ...

    The problem is with the second argument: -Xmx1500m or -XX:MaxPermSize=250m, the word or is interpreted as the name of the mainClass. Removing it should help you a bit further.