Jenkins maven build from stash issue - maven

While running a maven build from Jenkins using stash/bitbucket repo i am getting error. This is first time set of this project in stash/bitbucket and jenkins job as well
21:00:30 [INFO] Executing: /bin/sh -c cd /home/jenkins/workspace/project/folder && git push https://stash.xxx.com/scm/repo/folder refs/heads/develop:refs/heads/develop
21:00:30 [INFO] Working directory: /home/jenkins/workspace/project/folder
21:00:30 [INFO] -------------------------------------------------------------
21:00:30 [INFO] BUILD FAILURE
21:00:30 [INFO] -------------------------------------------------------------
21:00:30 [INFO] Total time: 41.539 s
21:00:30 [INFO] Finished at: 2017-10-01T16:00:30-04:00
21:00:31 [INFO] Final Memory: 14M/179M
21:00:31 [INFO] -------------------------------------------------------------
21:00:31 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project ifaview: Unable to commit files
21:00:31 [ERROR] Provider message:
21:00:31 [ERROR] The git-push command failed.
21:00:31 [ERROR] Command output:
21:00:31 [ERROR] fatal: could not read Username for 'https://stash.xxxx.com': No such device or address
jenkins configuration #Source Code Management>Git>Repositories>
Repository URL=https://stash.xxx.com/scm/repo/folder.git
Credentials: jenkins_user/xxxxx
In stash repo settings for jenkins_user
Repository permission: read, write
Branch permission: Changes without a pull request except jenkins_user
Pull request : merge and squash
Any one came across this problem, tried many other options as well...though no luck yet.

Related

Jenkins Maven integration failed

I am trying to integrate Jenkins with Maven. Through terminal I am able to execute the Maven command (clean install). But from Jenkins it fails.
Getting following error:
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /Users/krishna/eclipse-workspace/Tools/LearnBroswserStack/pom.xml clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building BrowserStackDemo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # BrowserStackDemo ---
[INFO] Deleting /Users/krishna/eclipse-workspace/Tools/LearnBroswserStack/target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.090 s
[INFO] Finished at: 2018-02-04T16:17:27+01:00
[INFO] Final Memory: 11M/190M
[INFO] ------------------------------------------------------------------------
**[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project BrowserStackDemo:** Failed to clean project: Failed to delete /Users/krishna/eclipse-workspace/Tools/LearnBroswserStack/target/.DS_Store -> [Help 1]
[ERROR]
[JENKINS] Archiving /Users/krishna/eclipse-workspace/Tools/LearnBroswserStack/pom.xml to BrowserStack/BrowserStackDemo/0.0.1-SNAPSHOT/BrowserStackDemo-0.0.1-SNAPSHOT.pom
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
/Users/krishna/eclipse-workspace/Tools/LearnBroswserStack/pom.xml is not inside /Users/Shared/Jenkins/Home/workspace/MavenJenkinsIntegration1/Users/krishna/eclipse-workspace/Tools/LearnBroswserStack/; will archive in a separate pass
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
channel stopped
Finished: FAILURE
Note:
I am not using any server like Tomcat. My problem is not able to delete the target folder from Jenkins, when ever I taken a clean build, target folder will create newly, so I am unable to give the access for the target folder.
Your Jenkins executor is unable to delete the target folder of project . The error statements points it out clearly.
*[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project BrowserStackDemo:** Failed to clean project: Failed to delete /Users/krishna/eclipse-workspace/Tools/LearnBroswserStack/target/.DS_Store -> [Help 1]
Such error occurs when the access to file is denied at the OS filesystem level OR the target folder's files are already being used somewhere in some other process and they are left in OPEN state. Try deleting the target folder manually.

Maven - Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4:single (1-pre-dist) on project

I'm using wso2 emm 2.2.0 Beta, Please refer the below error console. when I run the maven install I got maven assembly plugin issue.
So please let me know why it occurs? and give some suggestion to fix this problem.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WSO2 Mobile Device Manager (MDM) - Distribution 2.2.0-BETA2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- incremental-build-plugin:1.3:incremental-build (default) # wso2emm ---
[INFO] Verifying module descriptor ...
[INFO] Verifying parent modules...
[INFO] Verifying resources...
[INFO] Resources directory does not exist : /home/next/Praveen/Project/secureON/Project/Project_Setup/product-emm-2.2.0-BETA2/modules/distribution/src/main/resources
[INFO] Verifying sources...
[INFO] No sources to check ...
[INFO]
[INFO] --- buildnumber-maven-plugin:1.3:create (default) # wso2emm ---
[INFO] Storing buildNumber: 27 Oct 2016 at timestamp: 1477554746130
[WARNING] Cannot get the branch information from the git repository:
Detecting the current branch failed: fatal: Not a git repository (or any of the parent directories): .git
[INFO] Executing: /bin/sh -c cd /home/next/Praveen/Project/secureON/Project/Project_Setup/product-emm-2.2.0-BETA2/modules/distribution && git rev-parse --verify HEAD
[INFO] Working directory: /home/next/Praveen/Project/secureON/Project/Project_Setup/product-emm-2.2.0-BETA2/modules/distribution
[INFO] Storing buildScmBranch: UNKNOWN_BRANCH
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (default) # wso2emm ---
[INFO]
[INFO] --- maven-assembly-plugin:2.4:single (1-pre-dist) # wso2emm ---
[INFO] Reading assembly descriptor: /home/next/Praveen/Project/secureON/Project/Project_Setup/product-emm-2.2.0-BETA2/modules/distribution/src/assembly/dist.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.203s
[INFO] Finished at: Thu Oct 27 13:22:26 IST 2016
[INFO] Final Memory: 13M/188M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4:single (1-pre-dist) on project wso2emm: Failed to create assembly: Error creating assembly archive dist: You must set at least one file.
If you want to build WSO2 EMM 2.2.0 Beta follows the below steps.
Clone the product-emm repo
git clone https://github.com/wso2/product-emm.git
Checkout the v2.2.0-BETA tag.
git checkout v2.2.0-BETA
Build from root pom. Go to project root folder and issue
mvn clean install
If you want just product zip you can build the distribution module for that go to project root -> modules ->distribution folder and issue mvn clean install from there. you can find the build zip file in distribution/target folder.
It seems like you are in master branch. The failing maven goal for you added after the emm beta tag creation. The reason for failing is, in build time it tries to connect to some resources in internet and your computer failed to connect to that resources on internet. If you really want to build the master branch (2.2.0-SNAPSHOT), just check your internet connection or firewall blockings.

"Auth fail" error with maven-scm-provider-jgit during release:prepare

I am on a windows machine where git command line is not installed. I have installed GitExtensions and an EGit and this is sufficient for me (until now).
Now I wanted to perform a maven release to BinTray, following this guide:
Publishing releases using Github, Bintray and maven-release-plugin
Running:
mvn -Prelease release:prepare
Produces this output:
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxxx 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.4.1:prepare (default-cli) # xxxxx ---
[INFO] Resuming release from phase 'scm-commit-release'
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
[INFO] Working directory: C:\Users\jbr\git\yyyyyyyyyyyyyyy
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.770 s
[INFO] Finished at: 2015-09-12T20:17:24+02:00
[INFO] Final Memory: 20M/989M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:prepare (default-cli) on project xxxxx: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] 'git' is not recognized as an internal or external command,
[ERROR] operable program or batch file.
Absolutely fair, I never use the git command from the windows shell and I never set up the pageant.exe stuff. (for details see this answer to the question “Why git can't remember my passphrase under Windows”).
My second idea was to use the maven-scm-provider-jgit to not depend on the git command line.
The output is now:
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxxx 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.4.1:prepare (default-cli) # xxxxx ---
[INFO] Change the default 'git' provider implementation to 'jgit'.
[INFO] Resuming release from phase 'scm-commit-release'
[INFO] Checking in modified POMs...
[INFO] push changes to remote... refs/heads/master:refs/heads/master
[INFO] fetch url: git#github.com:jmini/yyyyyyyyyyyyyyy.git
[INFO] push url: git#github.com:jmini/yyyyyyyyyyyyyyy.git
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:prepare (default-cli) on project xxxxx: An error is occurred in the checkin process: Exception while executing SCM command. JGit checkin failure! git#github.com:jmini/yyyyyyyyyyyyyyy.git: Auth fail -> [Help 1]
Much better, but still no luck.
My guess is that the private key and the passphrase are not loaded. How should I configure them?
This answer suggests that for some SCM providers, it is possible to specify the credentials in the <servers> section of settings.xml. The domain name of the repository should be used as <id>.
According to the last comment with scm:git:ssh://git#bitbucket.org/{account}/{project} used in the <developerConnection>, this entry is working in the settings.xml:
<server>
<id>bitbucket.org</id>
<privateKey>/c/Users/neil.hunt/.ssh/id_rsa</privateKey>
</server>
Is this construct supported by the JGit SCM provider?
When searching for “Auth failed” error, I found this related question (plain JGit, no maven plugin):
How do you set the configuration for jschconfigsessionfactory for jgit so that pull and push work?

Maven build fails on Jenkins, but works on local machine

I have a fresh installed Debian Wheezy server running Jenkins 1.596 (The latest Version) installed from the official deb package.
For playing around with Jenkins, I crated a new Maven-Project which gets checked out with Git.
When I run Maven to build this project, on my local machine which has Maven version 3.0.5 installed, by executing mvn3 package the build is successfully, but when I try to build the project on the Jenkins server the build fails.
The plugins maven-resources-plugin (maven-resources-plugin:2.6) and maven-compiler-plugin (maven-compiler-plugin:2.5.1) are the same version on my dev system and the Jenkins server.
The build fails because of a error: cannot find symbol error which does not occur when building the project on my local system.
Here is the log generated by the Jenkins server during build:
Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/hidden/workspace
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url ssh://git#red.hiddencompany.com/srv/gitosis/repositories/hidden.git # timeout=10
Fetching upstream changes from ssh://git#red.hiddencompany.com/srv/gitosis/repositories/hidden.git
> /usr/bin/git --version # timeout=10
using GIT_SSH to set credentials
> /usr/bin/git -c core.askpass=true fetch --tags --progress ssh://git#red.hiddencompany.com/srv/gitosis/repositories/hidden.git +refs/heads/*:refs/remotes/origin/*
> /usr/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 0d5334724d01ec42ed23912f687eb412997eede8 (refs/remotes/origin/master)
> /usr/bin/git config core.sparsecheckout # timeout=10
> /usr/bin/git checkout -f 0d5334724d01ec42ed23912f687eb412997eede8
> /usr/bin/git rev-list 0d5334724d01ec42ed23912f687eb412997eede8 # timeout=10
Parsing POMs
[workspace] $ /var/lib/jenkins/tools/hudson.model.JDK/JDK_7/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-agent-1.6.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/boot/plexus-classworlds-2.5.1.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/conf/logging jenkins.maven3.agent.Maven32Main /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven /var/cache/jenkins/war/WEB-INF/lib/remoting-2.49.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-interceptor-1.6.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.6.jar 55526
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /var/lib/jenkins/jobs/hidden/workspace/pom.xml package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building hidden 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # hidden ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # hidden ---
[INFO] Compiling 15 source files to /var/lib/jenkins/jobs/hidden/workspace/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /var/lib/jenkins/jobs/hidden/workspace/src/main/java/com/logicsale/hidden/aggregator/provider/hiddencompany/AmazonSellerRatingsProvider.java:[41,58] error: cannot find symbol
[INFO] 1 error
[INFO] -------------------------------------------------------------
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.745 s
[INFO] Finished at: 2015-01-14T09:32:55+01:00
[INFO] Final Memory: 16M/39M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project hidden: Compilation failure
[ERROR] /var/lib/jenkins/jobs/hidden/workspace/src/main/java/com/logicsale/hidden/aggregator/provider/hiddencompany/AmazonSellerRatingsProvider.java:[41,58] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[JENKINS] Archiving /var/lib/jenkins/jobs/hidden/workspace/pom.xml to com.logicsale.hidden/hidden/1.0-SNAPSHOT/hidden-1.0-SNAPSHOT.pom
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
channel stopped
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
I tried building with JDK7 and JDK8 both fails.
Please have a look at this question and the accepted answer. Maybe it is a bug in the maven-compiler-plugin - try to update the version of the maven-compiler-plugin to 3.1 or newer.

Running mvn scm:status or release:prepare fails with RTC 4.x: "Error code for Jazz SCM status command - 54"

Both of these plugins fail the same way, which makes sense as the release plugin calls scm:status to ensure that there are no local modifications.
Here's the normal (short) error from running mvn release:prepare:
$ mvn -DworkingDirectory=/tmp/maven release:prepare release:perform
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building bar 2.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.5:prepare (default-cli) # bar ---
[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: **/pom.xml.backup, **/release.properties, **/pom.xml.branch, **/pom.xml.next, **/pom.xml.releaseBackup, **/pom.xml.tag
[INFO] Executing: /bin/sh -c cd /home/davisk/workspaces/foo/bar && scm status --username johndoe#us.ibm.com --password '*****'
[INFO] Working directory: /home/davisk/workspaces/foo/bar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.954 s
[INFO] Finished at: 2014-07-23T03:12:04-05:00
[INFO] Final Memory: 15M/481M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project bar: Unable to check for local modi
fications
[ERROR] Provider message:
[ERROR] Error code for Jazz SCM status command - 54
[ERROR] Command output:
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Running mvn scm:status -X, I can get the full underlying error message (trimmed):
[DEBUG] Consumed line :Workspace: (1023) "bar" (This workspace is unreachable.)
[DEBUG] Consumed line : Could not determine the URI required to connect to the repository. The UUID of
[DEBUG] Consumed line : the repository is _t2J8kWECEeKBH6O9T2VOlA. If you know the repository URI run
[DEBUG] Consumed line : 'login' command providing the repository URI. If not, please contact your
[DEBUG] Consumed line : administrator.
Need to get this resolved.
From some research, it sounds like Maven's RTC/Jazz SCM provider may have been built against the RTC 3.0 command line interface.
Fortunately, there seems to be a perfectly usable workaround: login via RTC's scm login command line tool ahead of time:
$ scm login --repository-uri https://fizz.example.com:9443/ccm --username johndoe#us.ibm.com
Password (johndoe#us.ibm.com # https://fizz.example.com:9443/ccm):
Logged in to https://fizz.example.com:9443/ccm
After running this once, it seems the login is cached somewhere, and the mvn scm:status call then works as expected.

Resources