.bat file not executing in jenkins - batch-file

i have made a main() class,which is calling testng.xml.In the testNG.xml,i have coded for all the testNG classes(test cases ,done by selenium).Now I have created a JAR of the main() class.Then I have created a .bat file to execute the JAR.
Problem:
I am trying to integrate my code with JENKINS,but each build is getting failed due to org.testng.TestNG Exception and NoclassFoundException
But whenever I am executing the JAR through .bat file(not in JENKINS) created.Its executing fine.

Step1
Add "Execute Windows batch command" from the job config.
Step2
cd your_bat_script_directory
foo.bat

Related

Batch file can not run successfully in SSIS package

In my task, I call DTEXEC /F to run an SSIS package which includes executing batch file error. But when I can run the batch file in command window successfully.
And I traced the SSIS package's process. It shows run this batch file fail.
Is there anybody faced same issues? How to resolve it?
Thanks

Batch script command automatically stops batch script

I am experiencing a strange issue with the following batch script run via cmd.exe on Windows:
#echo off
gradle wrapper
gradlew build
pause
This batch script only ever executes the first command, i.e. gradle wrapper. After that, the batch script automatically terminates and the command gradlew build is never executed.
Is there any way I can force the batch script so that it cannot be stopped by gradle wrapper and continues its execution normally after gradle wrapper has been called?
I have a feeling you may need to precede with call:
call gradle…

MSBuild execution fails through jenkins whereas same command runs properly through command prompt

I tried to execute the below command from Jenkins, and I got below error. I tried to print the command and executed the same command through cmd.exe and it runs successfully. I checked the folder permission and it is having the write permission. I ran jenkins using war file and saw it is executing under the same user as cmd.exe is running
Command that is executed on both jenkins and cmd.exe is,
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" "d:\jenkins\workspace\NewTestItem\App\abc.sln" /t:rebuild /p:PackageLocation=d:\jenkins\workspace\NewTestItem\iisPackageDeploymentDir\26\ /p:DeployOnBuild=True /p:Configuration=Release /m /v:d /fl /flp:LogFile=msbuild.log;Verbosity=Normal /nr:false
Error which I am getting in jenkins
Microsoft.Common.CurrentVersion.targets(3821,5): error MSB3021: Unable to copy file "d:\jenkins\workspace\NewTestItem\App\mgmt\UserGuide\US\help.pdf" to "bin\mgmt\UserGuide\US\help.pdf". Access to the path 'bin\mgmt\UserGuide\US\help.pdf' is denied.
Note : Solution contains multiple project

Jenkins Batch contains .exe command inside

I have a Jenkins job that runs an "Execute Windows batch command", inside that batch I have a.exe, Jenkins job fails with this message:
"a.exe is not recognized as an internal or external command"
but when I run manually batch that have inside a.exe is working.
Did you try Windows Exe Runner Plugin, I have been using it for a while and it let me run .exe from jenkins.

Nunit result xml is not updated during Jenkins build

I have configured NUnit tests to run after build completed.(Jenkins)
I added following on Excecute windows batch command window in Jenkins.
rmdir ClickOnceInstall /Q /S
mkdir ClickOnceInstall
CD BuildScripts
Start.bat
"C:\Program Files (x86)\NUnit 2.6.2\bin\nunit-console-x86.exe" AA.Tests\bin\x86\Release\AA.Tests.dll /xml=nunit-result.xml
It seems Execute unit test command doesn't create result file as specified name and marked as failed. However, when I run the nunit test command manually it creates the file. Next time build through Jenkins, result xml file does not seem to be updated but it doesn't fail.
am I missing any configuration or something else?
It would help if you would paste the console log.
However, my first guess is to ask you to add call to your batch file statement:
call Start.bat
If that batch file has an exit /b statement (even with 0), it will quit the whole calling step (i.e. "Execute windows batch command") without getting to your last statement (i.e nunit command).
Using call in front of the batch file will make sure that control is returned to the calling step.

Resources