Not able to build maven project using Maven configured with Jenkins - jenkins

Building in workspace C:\Users\5078722.jenkins\jobs\TempExp\workspace
> C:\Program Files (x86)\Git\bin\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> C:\Program Files (x86)\Git\bin\git.exe config remote.origin.url
Fetching upstream changes from
> C:\Program Files (x86)\Git\bin\git.exe --version # timeout=10
using .gitcredentials to set credentials
> C:\Program Files (x86)\Git\bin\git.exe config --local credential.helper store --file=\"C:\tomcat7\temp\git781129730469989565.credentials\" # timeout=10
Setting http proxy: internet.proxy.fedex.com:3128
> C:\Program Files (x86)\Git\bin\git.exe -c core.askpass=true fetch --tags --progress https://github.com/sharath502/MavenDemo.git +refs/heads/*:refs/remotes/origin/*
> C:\Program Files (x86)\Git\bin\git.exe config --local --remove-section credential # timeout=10
> C:\Program Files (x86)\Git\bin\git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
> C:\Program Files (x86)\Git\bin\git.exe rev-parse "refs/remotes/origin/origin/master^{commit}" # timeout=10
Checking out Revision acc2095cad14f15049ddb2c807a9200c530a0ed5 (refs/remotes/origin/master)
> C:\Program Files (x86)\Git\bin\git.exe config core.sparsecheckout # timeout=10
> C:\Program Files (x86)\Git\bin\git.exe checkout -f acc2095cad14f15049ddb2c807a9200c530a0ed5
> C:\Program Files (x86)\Git\bin\git.exe rev-list acc2095cad14f15049ddb2c807a9200c530a0ed5 # timeout=10
FATAL: Couldn’t find any executable in C:\maven
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
I have installed maven on my local machine and the maven --version command works well.

Did you declare your Maven installation in the global settings?
If not, please add your Maven installation ("My Maven install" --> C:\Maven).
Next, please update your Maven project and select the relevant Maven installation.

Related

Unable to build a Jenkins project. prompting java issues

Running as SYSTEM
Building in workspace /Users/mac/.jenkins/workspace/trainSchedule
The recommended git tool is: NONE
No credentials specified
git rev-parse --resolve-git-dir /Users/mac/.jenkins/workspace/trainSchedule/.git # timeout=10
Fetching changes from the remote Git repository
git config remote.origin.url https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins # timeout=10
Fetching upstream changes from https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins
git --version # timeout=10
git --version # 'git version 2.30.1 (Apple Git-130)'
git fetch --tags --force --progress -- https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins +refs/heads/:refs/remotes/origin/ # timeout=10
git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision 1603f84d1f50794623c71673920fc3111280045f (refs/remotes/origin/master)
git config core.sparsecheckout # timeout=10
git checkout -f 1603f84d1f50794623c71673920fc3111280045f # timeout=10
Commit message: "specify a newer version of node and npm"
First time build. Skipping changelog.
[Gradle] - Launching build.
[trainSchedule] $ /Users/mac/.jenkins/workspace/trainSchedule/gradlew build
FAILURE: Build failed with an exception.
What went wrong:
Could not determine java version from '19'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Archiving artifacts
Finished: FAILURE

Manual git pull is able to copy latest master repository code but when I pull from Jenkins build job old master is getting pulled

Manual git pull is able to copy latest master repository code but when I pull from Jenkins build job old master is getting pulled.
we can see old pull request in below logs but not the latest.
Please help me on this.
Thanks
01:48:26 > C:\Program Files\Git\cmd\git.exe rev-parse "refs/remotes/origin/refs/remotes/origin/master^{commit}" # timeout=10
01:48:26 > C:\Program Files\Git\cmd\git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
01:48:27 Checking out Revision b971a3367b2e015d83a34d0ba2cb92a3bf1e916a (refs/remotes/origin/master)
01:48:27 Enabling Git LFS pull
01:48:27 > C:\Program Files\Git\cmd\git.exe config core.sparsecheckout # timeout=10
01:48:27 > C:\Program Files\Git\cmd\git.exe checkout -f b971a3367b2e015d83a34d0ba2cb92a3bf1e916a # timeout=10
01:48:31 > C:\Program Files\Git\cmd\git.exe config --get remote.origin.url # timeout=10
01:48:31 using GIT_SSH to set credentials Manny Bitbucket Key
01:48:31 > C:\Program Files\Git\cmd\git.exe lfs pull origin # timeout=10
01:49:06 Commit message: "Merged in LicenseTestsScenario (pull request #41)"

How to run a command from the GitHub directory that Jenkins clones into?

I put "make" in Jenkins's Execute Shell, following the tutorial here https://github.com/jbankes/Hello_Jenkins, but Jenkins does not run the make from the underlying Github repository, as shown in the error message below.
What is the right way to demand Jenkins to run "make" from its monitored GitHub repository?
Running as SYSTEM
Building in workspace /var/jenkins_home/workspace/test003
The recommended git tool is: NONE
No credentials specified
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/zhoulaifu/Hello_Jenkins # timeout=10
Fetching upstream changes from https://github.com/zhoulaifu/Hello_Jenkins
> git --version # timeout=10
> git --version # 'git version 2.20.1'
> git fetch --tags --force --progress -- https://github.com/zhoulaifu/Hello_Jenkins +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision bc3931a313e4f3945c257ae3247e63265b1debb7 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f bc3931a313e4f3945c257ae3247e63265b1debb7 # timeout=10
Commit message: "Otherside (#5)"
> git rev-list --no-walk bc3931a313e4f3945c257ae3247e63265b1debb7 # timeout=10
[test003] $ /bin/sh -xe /tmp/jenkins2704537311990415428.sh
+ make
make: *** No targets specified and no makefile found. Stop.
Build step 'Execute shell' marked build as failure
Finished: FAILURE
In the repository Make file located inside original folder. So to be able to run Make you need navigate to it.
After git clone execute cd original/ and then run Make.

Downstream job is not receiving the build parameters from the upstream job

I'm using ant to generate build parameters in the upstream job and passing them down using "Trigger Parameterized build on other projects". But the downstream job is not receiving them , even though both the builds are Restricted to the same node.
I have other jobs in the pipeline where the build parameter is passing but not when I'm moving from one stage to another.
Sample Output:
16:57:35 Running as SYSTEM
16:57:35 Setting version to: #89-NEXT from upstream version
16:57:35 [EnvInject] - Loading node environment variables.
16:57:35 Building remotely on Slave (wraith acceptance ios-slave integration javascript php7.1) in workspace /var/lib/jenkins/workspace/in-release-services
16:57:35 using credential gourav-git
16:57:35 > git rev-parse --is-inside-work-tree # timeout=10
16:57:35 Fetching changes from the remote Git repository
16:57:35 > git config remote.origin.url git#github.com:InterNations/in.git # timeout=10
16:57:35 Cleaning workspace
16:57:35 > git rev-parse --verify HEAD # timeout=10
16:57:35 No valid HEAD. Skipping the resetting
16:57:35 > git clean -fdx # timeout=10
16:57:35 Fetching upstream changes from git#github.com:InterNations/in.git
16:57:35 > git --version # timeout=10
16:57:35 using GIT_SSH to set credentials gourav-git-jenkins
16:57:35 > git fetch --no-tags --progress git#github.com:InterNations/in.git +refs/heads/*:refs/remotes/origin/*
16:57:37 > git rev-parse origin/$GIT_APP_REVISION^{commit} # timeout=10
16:57:37 > git rev-parse $GIT_APP_REVISION^{commit} # timeout=10
16:57:37 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
16:57:37 ERROR: Build step failed with exception
16:57:37 java.io.IOException: Cannot retrieve Git metadata for the build
16:57:37 at org.jenkinsci.plugins.github.util.BuildDataHelper.getCommitSHA1(BuildDataHelper.java:87)
16:57:37 at org.jenkinsci.plugins.github.status.sources.BuildDataRevisionShaSource.get(BuildDataRevisionShaSource.java:32)
16:57:37 at org.jenkinsci.plugins.github.status.GitHubCommitStatusSetter.perform(GitHubCommitStatusSetter.java:135)
16:57:37 Caused: org.jenkinsci.plugins.github.common.CombineErrorHandler$ErrorHandlingException
16:57:37 at org.jenkinsci.plugins.github.common.CombineErrorHandler.handle(CombineErrorHandler.java:74)
16:57:37 at org.jenkinsci.plugins.github.status.GitHubCommitStatusSetter.perform(GitHubCommitStatusSetter.java:164)
16:57:37 at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:79)
16:57:37 at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
16:57:37 at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
16:57:37 at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
16:57:37 at hudson.model.Build$BuildExecution.post2(Build.java:186)
16:57:37 at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
16:57:37 at hudson.model.Run.execute(Run.java:1841)
16:57:37 at com.tikal.jenkins.plugins.multijob.MultiJobBuild.run(MultiJobBuild.java:76)
16:57:37 at hudson.model.ResourceController.execute(ResourceController.java:97)
16:57:37 at hudson.model.Executor.run(Executor.java:429)
Expected Output:
Running as SYSTEM
Setting version to: #6558-deploy/2020-03-03 from upstream version
[EnvInject] - Loading node environment variables.
Building remotely on docker-ci-040 (database test integration php7.1 guestlist-app) in workspace /var/lib/jenkins/workspace/in-release-services
using credential github-internations-jenkins
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git#github.com:InterNations/in.git # timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
Resetting working tree
> git reset --hard # timeout=10
> git clean -fdx # timeout=10
Fetching upstream changes from git#github.com:InterNations/in.git
> git --version # timeout=10
using GIT_SSH to set credentials GitHub internations-jenkins SSH user
> git fetch --no-tags --progress git#github.com:InterNations/in.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse 54ba1520d2a11276fc3d564c5b5312388abddd10^{commit} # timeout=10
Checking out Revision 54ba1520d2a11276fc3d564c5b5312388abddd10 (detached)
Enabling Git LFS pull
> git config core.sparsecheckout # timeout=10
> git checkout -f 54ba1520d2a11276fc3d564c5b5312388abddd10
> git config --get remote.origin.url # timeout=10
using GIT_SSH to set credentials GitHub internations-jenkins SSH user
> git lfs pull origin

Grails 3.1.2 project by Jenkins: Unknown command-line option '-n'

I copy-pasted jenkins job (which works in Grails 2.4.5) but it fails in new Grails 3.1.2 project:
Started by user Michal Szulc
Building in workspace <http://jenkins.example.com/job/project-server/ws/>
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.project-server_repository.url http://git.example.pl/scm/es/project-server.git # timeout=10
Fetching upstream changes from http://git.example.pl/scm/es/project-server.git
> /usr/bin/git --version # timeout=10
using .gitcredentials to set credentials
> /usr/bin/git config --local credential.helper store --file=/tmp/git6110612657385406031.credentials # timeout=10
> /usr/bin/git -c core.askpass=true fetch --tags --progress http://git.example.pl/scm/es/project-server.git +refs/heads/*:refs/remotes/project-server_repository/*
> /usr/bin/git config --local --remove-section credential # timeout=10
> /usr/bin/git rev-parse refs/remotes/project-server_repository/master^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/project-server_repository/project-server_repository/master^{commit} # timeout=10
Checking out Revision eb5ef3113a02e6dc325d91ba5cc4b9ee7b935c90 (refs/remotes/project-server_repository/master)
> /usr/bin/git config core.sparsecheckout # timeout=10
> /usr/bin/git checkout -f eb5ef3113a02e6dc325d91ba5cc4b9ee7b935c90
> /usr/bin/git rev-list eb5ef3113a02e6dc325d91ba5cc4b9ee7b935c90 # timeout=10
[project-server] $ /var/lib/jenkins/tools/com.g2one.hudson.grails.GrailsInstallation/3.1.2/bin/grails -Dgrails.work.dir=<http://jenkins.example.com/job/project-server/ws//target> -Dserver.port=40855 clean --non-interactive --plain-output
Error |
Command [clean] error: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.11-bin.zip'.
Problem with provided build arguments: [-non-interactive, --console, plain].
Unknown command-line option '-n'.
Either it is not a valid build option or it is not supported in the target Gradle version.
Not all of the Gradle command line options are supported build arguments.
Examples of supported build arguments: '--info', '-u', '-p'.
Examples of unsupported build options: '--daemon', '-?', '-v'.
Please find more information in the javadoc for the BuildLauncher class. (Use --stacktrace to see the full trace)
Build step 'Build With Grails' marked build as failure
If I run ./gradlew clean or ./gradlew war in local environment it works perfectly. How to run it by jenkins?
I'm still not sure why this situation has happened but I resolved an issue by changing Build -> Build With Grails -> Targets:
clean "war api.project-server.pl.war"
to:
"war api.project-server.pl.war"

Resources