Repository: git-commit-id/git-commit-id-maven-plugin

Issue #450: JDK 13: org.eclipse.jgit.api.errors.TransportException: USERAUTH fail
Created: 2019-11-04T13:21:29Z
Describe the bug
After upgrading to JDK 13 got an error.
Steps to Reproduce

Please include the full configuration of the plugin

<plugin>
	<groupId>pl.project13.maven</groupId>
	<artifactId>git-commit-id-plugin</artifactId>
	<version>3.0.1</version>
</plugin>

Is there a (public) project where this issue can be reproduced? If so please provide a link.
no
Include any stack-traces or any error messages

[ERROR] Failed to perform fetch
org.eclipse.jgit.api.errors.TransportException: ssh://git@bitbucket.server.local:7999/api/service.git: USERAUTH fail
at org.eclipse.jgit.api.FetchCommand.call (FetchCommand.java:254)
at pl.project13.maven.git.JGitProvider.fetch (JGitProvider.java:352)
at pl.project13.maven.git.JGitProvider.getAheadBehind (JGitProvider.java:339)
at pl.project13.maven.git.GitDataProvider.lambda$loadGitData$17 (GitDataProvider.java:174)
at pl.project13.maven.git.GitDataProvider.lambda$memoize$23 (GitDataProvider.java:272)
at pl.project13.maven.git.GitDataProvider.lambda$loadGitData$18 (GitDataProvider.java:175)
at pl.project13.maven.git.GitDataProvider.maybePut (GitDataProvider.java:255)
at pl.project13.maven.git.GitDataProvider.loadGitData (GitDataProvider.java:175)
at pl.project13.maven.git.GitCommitIdMojo.loadGitDataWithJGit (GitCommitIdMojo.java:604)
at pl.project13.maven.git.GitCommitIdMojo.loadGitData (GitCommitIdMojo.java:563)
at pl.project13.maven.git.GitCommitIdMojo.execute (GitCommitIdMojo.java:458)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:567)
at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:55)
Caused by: org.eclipse.jgit.errors.TransportException: ssh://git@bitbucket.server.local:7999/api/service.git: USERAUTH fail
Expected behavior

Please provide a description of what you expected to happen.
no errors during build

Additional context
For reproducibility please provide the following:


the plugin version is being used (if not included in the configuration)


the Java-Version is being used (output of java -version and also include details about oracle-jdk VS open-jdk)
openjdk version "13.0.1" 2019-10-15
OpenJDK Runtime Environment Zulu13.28+11-CA (build 13.0.1+10-MTS)


the Maven-Version is being used (output of mvn --version)
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T21:41:47+03:00)


on what Operating System you experience the bug (on Linux run lsb_release -a or cat /etc/*release*)
Ubuntu 18.04.3 LTS


in what context maven is being executed (e.g. inside Windows Terminal, Powershell, Git Bash, /bin/bash, ...)
ZSH


how maven is being executed (e.g. mvn clean deploy VS mvn deploy:deploy)
./mvnw clean package
Feel free to add any other context or screenshots about the bug.

Duplicate issue #458: Have the plugin operate in "offline mode" by default to prevent issues since 3.x where the revision goal throws Exception: Caused by: com.jcraft.jsch.JSchException: Auth fail
Created: 2019-12-11T10:51:32Z
Description
When i use the Springboot 2.2.x, its default version of git-commit-id is 3.0.1, but this version will cause build error log and there is no problem with git-commit-id:2.2.6. Here is the exception segment:
org.eclipse.jgit.api.errors.TransportException: git@xxxxx.git: Auth fail
    at org.eclipse.jgit.api.FetchCommand.call (FetchCommand.java:254)
    at pl.project13.core.JGitProvider.fetch (JGitProvider.java:351)
    at pl.project13.core.JGitProvider.getAheadBehind (JGitProvider.java:338)
    at pl.project13.core.GitDataProvider.lambda$memoize$6 (GitDataProvider.java:274)
    at pl.project13.core.GitDataProvider.lambda$loadGitData$2 (GitDataProvider.java:177)
    at pl.project13.core.GitDataProvider.maybePut (GitDataProvider.java:257)
    at pl.project13.core.GitDataProvider.loadGitData (GitDataProvider.java:177)
    at pl.project13.maven.git.GitCommitIdMojo.loadGitDataWithJGit (GitCommitIdMojo.java:639)
    at pl.project13.maven.git.GitCommitIdMojo.loadGitData (GitCommitIdMojo.java:598)
    at pl.project13.maven.git.GitCommitIdMojo.execute (GitCommitIdMojo.java:489)
I read the source code and find that : since 3.x , add two properties (GitDataProvider#loadGitData  line 174)
SupplierEx<AheadBehind> aheadBehindSupplier = memoize(() -> getAheadBehind());
maybePut(properties, GitCommitPropertyConstant.LOCAL_BRANCH_AHEAD, () -> aheadBehindSupplier.get().ahead());
maybePut(properties, GitCommitPropertyConstant.LOCAL_BRANCH_BEHIND, () -> aheadBehindSupplier.get().behind());
This looks like lead to the problem : it will connect the remote git repository and get some infos, that is the Auth fail and i don't know how to fix it（my native git works well, the .ssh directory has no problem）
Expected behavior
when mvn compile , i expect no error logs, even if it was ignored and the build is finally "SUCCESS".
Additional context
plugin version : 3.0.1
maven : 3.6.1
os: mac
command: mvn compile

Closing comment (2019-12-11T18:20:38Z): Hi,
thanks for reporting your problem here.....I feel like this plugin should go ahead and not include those properties, since it seems to cause a lot of problems.
In general this seems related to #450 and #446 and is now the third issue reported about this.
So far you have the following ways to avoid this issue:

set <offline>true</offline>
use native <useNativeGit>true</useNativeGit>

If you don't have control over the direct config you can also use -Dmaven.gitcommitid.nativegit=true as command-line argument.