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

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?

Related

Jenkins maven build from stash issue

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.

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.

How to debug "The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found"?

This is what I am trying to do. I have installed Maven. Set the path till bin folder of Maven.
C:\Workspace\Eaxample>mvn archetype:generate -DgroupId=com.mkyong -DartifactId=N
umberGenerator
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retri
eved from repository: central due to an error: Error transferring file: Connecti
on timed out: connect
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exi
st or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21 seconds
[INFO] Finished at: Tue Nov 24 14:04:15 IST 2015
[INFO] Final Memory: 5M/122M
You forget archetypeArtifactId :
Do this :
mvn archetype:generate -DgroupId={project-packaging}
-DartifactId={project-name}
-DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false
http://www.mkyong.com/maven/how-to-create-a-java-project-with-maven/

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.

Using maven-release-plugin with GitHub "You can't push to git://github.com/..."

Recently having switched source code repository for a project to GitHub from SourceForge I need to update the maven release process to match. I followed this link for configuring the "scm" section of the pom. The GitHub repository is shown here. Everything else is as it was when using SVN (for publishing to https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-4.MavenRepositories). So then I invoke
mvn clean release:clean release:prepare release:perform
and the output is as follows
[INFO] --- maven-release-plugin:2.1:prepare (default-cli) # datanucleus-maven-parent ---
[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: pom.xml.next, release.properties, pom.xml.releaseBackup, pom.xml.backup, pom.xml.branch, pom.xml.tag
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git status
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] Checking dependencies and plugins for snapshots ...
What is the release version for "DataNucleus Maven parent project"? (org.datanucleus:datanucleus-maven-parent) 3.3: :
What is SCM release tag or label for "DataNucleus Maven parent project"? (org.datanucleus:datanucleus-maven-parent) datanucleus-maven-parent-3.3: :
What is the new development version for "DataNucleus Maven parent project"? (org.datanucleus:datanucleus-maven-parent) 3.4-SNAPSHOT: :
[INFO] Transforming 'DataNucleus Maven parent project'...
[INFO] Not generating release POMs
[INFO] Executing goals 'clean verify'...
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && /usr/local/maven3/bin/mvn clean verify --no-plugin-updates -Psonatype-oss-release -P development
[WARNING] Command line option -npu is deprecated and will be removed in future Maven versions.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DataNucleus Maven parent project 3.3
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # datanucleus-maven-parent ---
[INFO] Deleting /home/andy/work/datanucleus/datanucleus-maven-parent (includes = [*.log], excludes = [])
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) # datanucleus-maven-parent ---
[INFO]
[INFO] --- maven-bundle-plugin:2.4.0:manifest (default) # datanucleus-maven-parent ---
[WARNING] Ignoring project type pom - supportedProjectTypes = [jar, bundle]
[INFO]
[INFO] --- maven-source-plugin:2.1.2:jar-no-fork (attach-sources) # datanucleus-maven-parent ---
[INFO]
[INFO] --- maven-javadoc-plugin:2.7:jar (attach-javadocs) # datanucleus-maven-parent ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-gpg-plugin:1.1:sign (sign-artifacts) # datanucleus-maven-parent ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.535s
[INFO] Finished at: Sat Dec 14 08:51:07 GMT 2013
[INFO] Final Memory: 14M/491M
[INFO] ------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git add -- pom.xml
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git status
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git commit --verbose -F /tmp/maven-scm-1907822841.commit pom.xml
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git symbolic-ref HEAD
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] Executing: /bin/sh -c cd /home/andy/work/datanucleus/datanucleus-maven-parent && git push git://github.com/datanucleus/datanucleus-maven-parent.git master:master
[INFO] Working directory: /home/andy/work/datanucleus/datanucleus-maven-parent
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.885s
[INFO] Finished at: Sat Dec 14 08:51:07 GMT 2013
[INFO] Final Memory: 15M/491M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1:prepare (default-cli) on project datanucleus-maven-parent: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] fatal: remote error:
[ERROR] You can't push to git://github.com/datanucleus/datanucleus-maven-parent.git
[ERROR] Use https://github.com/datanucleus/datanucleus-maven-parent.git
Now a connection of "scm:git:git://github.com/{organization}/{project}.git" is what all examples I've seen for maven-release-plugin so would appreciate any insight in why it doesn't work here, or what I could look at to find out why. I can do a git push to the same URL using the user I'm logged on here as (GitHub has the SSH key).
I tried swapping the scm connection/developerConnection over to https and then get username/password prompted and it then hangs (it updates the GitHub repo with the version without SNAPSHOT) but that's all.
Actually the problem was more of believing web links of how you should configure your SCM section, so I post the answer here in case anyone else hits this message. The connection/developerConnection should be of the form
scm:git:git#github.com:{organization}/{project}.git

Resources