Not able to run maven command (mvn -version) through jenkins on mac machin but same command working fine for terminal of mac machine - ios

Users/Shared/Jenkins/tmp/jenkins6366168807637424809.sh: line 2: mvn: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I tried to change the path of Maven in Jenkins but it did't work .
I have set maven path on Global tool configuration.
Name-M2_HOME
Path-/Applications/apache-maven-3.6.0

you should point the PATH to bin folder, like /Applications/apache-maven-3.6.0/bin

Related

I can't build and install a project with Cmake on Jenkins

I really need some help to build a simple project with Cmake with Jenkins.
I downloaded the Cmake plugin on Jenkins.
I configured it in the job :
and in Global Tool Configuration :
But then it doesn't work. Here are the end of the logs before the Jenkins build fails :
+ ls
CMakeLists.txt
MathFunctions
TutorialConfig.h.in
build
tutorial.cxx
[build] $ cmake /var/jenkins_home/workspace/Project
ERROR: Cannot run program "cmake" (in directory "/var/jenkins_home/workspace/Project/build"): error=2, No such file or directory
Build step 'CMake Build' marked build as failure
Finished: FAILURE
I don't understand why there is no proper step-by-step tutorial to create something that common as a Cmake build with Jenkins.
In the end, I managed to pull it off.
I uninstalled the Cmake plugin which seems to be useless apparently...
And I simply installed Cmake manually on the Jenkins container.

Jenkins dotnet command not found

I am trying to setup CI locally with Jenkins on OSX, however I am having some issues when trying to execute shell commands. Here are the commands I am trying to run in the Jenkins configuration:
cd /Users/username/projectname
dotnet build HD-Project.sln
However, when I try and build the project, I get the following errors:
Building in workspace /Users/Shared/Jenkins/Home/workspace/HD-Build
[HD-Build] $ /bin/sh -xe
/Users/Shared/Jenkins/tmp/jenkins2699993427980474696.sh
+ cd /Users/username/projectname
+ dotnet build HD-Project.sln
/Users/Shared/Jenkins/tmp/jenkins2699993427980474696.sh: line 3:
dotnet: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Any help would be greatly appreciated, thanks.
I got this working, and was successfully able to run dotnet commands through an executed shell via Jenkins.
To run dotnet commands, the .NET SDK needs to be installed on the Jenkins build server. Instructions on how to install the .NET SDK can be found here: https://www.microsoft.com/net/learn/get-started/macos for all OS - Linux, MacOS and Windows.
This happens because the installation package does not add the dotnet executable location to the PATH environment variable. This issue is mentioned in https://github.com/dotnet/core/blob/master/cli/known-issues.md#users-of-zsh-z-shell-dont-get-dotnet-on-the-path-after-install, but apparently it does not affect only zsh users. You need to add this path manually.
In my case the path was /usr/local/share/dotnet, so I ran (from the command line):
export PATH=/usr/local/share/dotnet:$PATH
Taken from https://github.com/dotnet/cli/issues/4357

Ant build: works in terminal, fails in Jenkins

I have a Java project developed in Eclipse. The project builds fine in Eclipse. Now I want to build it in Jenkins. From Eclipse, I have exported an Ant build.xml, which I have added to a Jenkins project.
When I run the build in Jenkins it immediately generates an error. This is the (anonymised) console output:
Started by user Admin User
Building in workspace /var/lib/jenkins/workspace/Project1
[projectname] $ ant -file build.xml class1.method1 class1.method2 Buildfile:
/home/ubuntu/eclipse-workspace/projectname/build.xml
class1.method1:
BUILD FAILED /home/ubuntu/eclipse-workspace/projectname/build.xml:91:
Could not create tempfile in /home/ubuntu/eclipse-workspace/projectname
Total time: 4 seconds Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
I copied the Ant command line from the console and ran it in a terminal window (in the folder where the build.xml exists) and it worked fine.
I am using Jenkins 2.60.2, Ant 1.9.6, Jenkins Ant plugin 1.5, Ubuntu 16.04.
I'm fairly new to working with these tools on Ubuntu but I guess it is something to do with either my Jenkins/Ant configuration or user permissions. What have I missed?

command not found when executed from jenkins, but runs on mac agent

I have Jenkins set up on a Windows machine, with a mac slave configured.
When I run the command nuget directly from terminal, it works. However when I try running the nuget command from Jenkins as a executable shell, I get command not found
[iOS Build] $ /bin/sh -xe /var/folders/hr/b_p9skp53178b45895w2htw80000gn/T/hudson278562289764277217.sh
+ nuget restore '/Users/a/Jenkins/workspace/iOS Build/App/Acquaint.Native.sln'
/var/folders/hr/b_p9skp53178b45895w2htw80000gn/T/hudson278562289764277217.sh: line 2: nuget: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I already have the directory where nuget resides configured in the PATH environment variable
maybe:
echo $PATH within your job to ensure it's configured as you expect when the job runs.
try including the full path to nuget. run /usr/local/bin/nuget restore... (or wherever nuget is found) instead of nuget restore... to determine if it's really a PATH issue.

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.

Resources