issue in jenkins integration with git - jenkins

i installed jenkins in c:\program files(x86)\jenkins and am trying to integrate with a helloworld java file. but when i first tried to build from jenkins, itself, its failed.
i went through this link : https://www.youtube.com/watch?v=bGqS0f4Utn4
when i compiled my java file, from the admin cmd prompt, its compiles successfully. but it failed within the jenkins console.
I created a C:\workspace folder and saved the java file, there.
what am doing wrong ? why am getting the wrong path within the console output?
am getting the below error in the console output :
`Console Output
Started by user user1
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building in workspace C:\Program Files (x86)\Jenkins\workspace\
HelloWorld
[HelloWorld] $ cmd /c call C:\Windows\TEMP\jenkins6223662388306682118.bat
C:\Program Files (x86)\Jenkins\workspace\HelloWorld>cd C:\Workspace
C:\Workspace>javac Hello.java
'javac' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace>java Hello
'java' is not recognized as an internal or external command,
operable program or batch file.
C:\Workspace>exit 9009
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

First, since you've installed JDK, make sure you've added in system level environment variable
Set JDK bin path in Jenkins > manage jenkins > global tools configurations > jdk installations, then try
mostly this option would help to resolve

Related

Jenkins couldn't recognize Python run from .BAT file

I'm a beginner to Jenkins, and trying to run a small Python code from Jenkins batch command for Windows.
However, the build run throws below error:
Running as SYSTEM
Building in workspace C:\Program Files (x86)\Jenkins\workspace\PythonProject1
[PythonProject1] $ cmd /c call C:\Windows\TEMP\jenkins7865401366299588301.bat
C:\Program Files (x86)\Jenkins\workspace\PythonProject1>cd C:\Users\Ben\Desktop\py
C:\Users\Ben\Desktop\py>python C:\Users\Ben\Desktop\py\for.py
'python' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Ben\Desktop\py>exit 9009
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Python is installed in my machine and is declared in Environment Variable too. What am I missing?
"Running as SYSTEM" means the Jenkins service is not running with your account, but the Windows system account, used as a service account.
That means you need to add python path to the system environment variables, not the user ones.

Why Jenkins failure with Error : Exit 9009

I am trying to deploy a Katalon Testcase to Jenkins but some errors appear, such as:
is not recognized as an internal or external command
Exit 9009
Jenkin using old update jenkin.war
You should Update file at : https://jenkins.io/doc/book/installing/#installing-docker
WAR file
The Web application ARchive (WAR) file version of Jenkins can be installed on any operating system or platform that supports Java.
To download and run the WAR file version of Jenkins:
Download the latest stable Jenkins WAR file to an appropriate directory on your machine.
Open up a terminal/command prompt window to the download directory.
Run the command java -jar jenkins.war.
Browse to http://localhost:8080 and wait until the Unlock Jenkins page appears.
Continue on with the Post-installation setup wizard below.
Solve it well

How to resolve grunt not recognizable error on jenkins whereas Grunt is running in command prompt?

How to resolve grunt not recognizable error on jenkins whereas Grunt is running in command prompt?
Jenkins output:
test cases will be executed
'grunt' is not recognized as an internal or external command, operable program or batch file.
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Most probably if the grunt-cli package is installed globally, you do not have the executable path added to system's PATH variable.
Or in the case when you do not have the package installed, npm install -g grunt-cli in windows shell.
Issue was related to path,basically my user's path variable had npm and grunt paths but was missing from system path variable.So i added npm path to system path variable and it worked for jenkins!
In my case the path was defined correctly. It worked when I execute it on CMD, but not from Jenkins. Turns out it was due to Jenkins using its own managed path, as defined in Manage Jenkins -> Configure System -> Global Properties.
Define Environment variable named "Path" there, and add the location of your npm directory to it, such as: "C:\Users\your-user-name\AppData\Roaming\npm;"

Jenkins is not able to recognize xmlstarlet in my shell script

I have Jenkins running on my local Windows 7 machine. I am trying to use Jenkins for Salesforce deployment and have added a shell script to parse package.xml. My script uses xmlstarlet to do the parsing, but when I build the project I am getting the following error:
./modifyPackage.bash: line 9: xml: command not found
./modifyPackage.bash: line 24: unexpected EOF while looking for matching `"'
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I am using the git sh.exe to execute the shell script, so I have added the below path in Shell executable.
C:\Program Files\Git\bin\sh.exe
Looks to me that Jenkins is not able to recognize the xml starlet used in shell script. I also tried adding xmlstarlet-1.6 exe file in the GIT directory, but it didn't work. How should I fix this?
Regards
Found out the problem. I needed to add the path of xml starlet as a PATH environment variable in Manage Jenkins -> Configure System -> Global Properties with key as PATH and value as $PATH:$Actual Path of xml starlet.

Running a Windows batch file in Jenkins

I trying to run my Tests cases for a project in Jenkins through DOS Command line on Windows server . I am using Jenkins ver. 1.559.
I am trying to run a Windows batch file through a Jenkins job that has the java command.
Under the "Build" section >> "Execute Windows Batch command" >> Command: call E:\Jenkins\App\UnitTests\App_UnitTests.bat
Save and Build the job.
I am getting an error and here is my Console Output
C:\Program Files (x86)\Jenkins\jobs\App Test Cases\workspace>java.exe -cp "E:\Jenkins\App\PPS\App\bin\;E:\Jenkins\App\PPS\App\lib\junit-4.10.jar;E:\Jenkins\App\PPS\App\lib\*.jar;" org.junit.runner.JUnitCore com.omnitracs.fra.junit.EventTests
'java.exe' is not recognized as an internal or external command, operable program or batch file.
C:\Program Files (x86)\Jenkins\jobs\App Test Cases\workspace>PAUSE
Press any key to continue . . .
C:\Program Files (x86)\Jenkins\jobs\App Test Cases\workspace>EXIT
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
The java command runs fine outside Jenkins.
I have set the JAVA_HOME for the local user and also the PATH variable to point to where java.exe is.
What am I doing wrong? Please help.
For a windows environment, there is some extra configuration needed for more advanced builds. Ultimately you have two options
From Jenkins, The Definitive Guide:
This basic installation will work fine in a simple context, but you
will often need to fine-tune your service. For example, by default,
the Jenkins service will be running under the local System account.
However, if you are using Maven, Jenkins will need an .m2 directory
and a settings.xml file in the home directory. Similarly, if you
are using Groovy, you might need a .groovy/lib directory. And so on.
To allow this, and to make testing your Jenkins install easier, make
sure you run this service under a real user account with the correct
development environment set up. Alternatively, run the application as the
system user, but use the System Information page in Jenkins to check
the /Users/johnsmart/Projects/Books/jenkins-thedefinitive- guide
directory, and place any files that must be placed in the user home
directory here....
To configure your Jenkins server to run under a service account (The suggested option), Install Jenkins as a service, and under the services properties set the log on user info.

Resources