Rameshwar
Rameshwar

Reputation: 551

Unable to execute maven command on jenkins

I have a jenkins job that checks out code from TFS and executes a test class using testng.xml

I have Maven properly installed in my machine in C:\JenkinsDependencies\apache-maven

It has mvn.bat file in its bin folder.

But when I execute my job, it fails with the following error.

Checking for pre-build [TFS_LN_Mobile] $ cmd.exe /C '"C:\JenkinsDependencies\apache-maven\bin\mvn.bat test && exit %%ERRORLEVEL%%"'

Error occurred during initialization of VM

java/lang/NoClassDefFoundError: java/lang/Object

Build step 'Invoke top-level Maven targets' marked build as failure

Checking for post-build Finished: FAILURE

Below is the configuration of my jenkins job: enter image description here I manually executed a batch command as follows:

cd "C:\JenkinsRoot\workspace\TFS_LN_Mobile"
mvn test -DsuiteXmlFile=testng.xml

This works fine.

Upvotes: 1

Views: 2370

Answers (1)

ilj
ilj

Reputation: 869

mvn.bat is a batch script. you can try adding trace of it's variables after steps that might produce this error. take a look at this: Is there any way to trace through the execution of a batch file?

Upvotes: 1

Related Questions