Failed to perform fetch
mvn clean package
[ERROR] Failed to perform fetch
org.eclipse.jgit.api.errors.TransportException: ssh://[email protected]:5353/plat/my-framework.git: remote hung up unexpectedly
at org.eclipse.jgit.api.FetchCommand.call (FetchCommand.java:222)
at pl.project13.core.JGitProvider.fetch (JGitProvider.java:350)
...
Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.jgit.transport.SshSessionFactory.getSession(org.eclipse.jgit.transport.URIish, org.eclipse.jgit.transport.CredentialsProvider, org.eclipse.jgit.util.FS, int)" because "this.sch" is null
at org.eclipse.jgit.transport.SshTransport.getSession (SshTransport.java:107)
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.3</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
</configuration>
</plugin>
I found tow method to fix it.
- use nativegit: -Dmaven.gitcommitid.nativegit=true
- add
jgit jschdependency forgit-commit-id-plugin
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
...
<dependencies>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ssh.jsch</artifactId>
<version>5.9.0.202009080501-r</version>
</dependency>
</dependencies>
</plugin>
because of eclipse:jgit remove DefaultSshSessionFactory
Use ServiceLoader to define the default SSH session factory
Hi, thanks for creating a ticket for this. Could you perhaps try the workaround outlined in https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/458#issuecomment-564670250 and see if this helps?
Hi, thanks for creating a ticket for this. Could you perhaps try the workaround outlined in #458 (comment) and see if this helps?
@TheSnoozer Thanks for your help.
The end of this's ticket have tow fix methods, include useNativeGit.
I think the best fix
git-commit-id-plugin need to add a dependency org.eclipse.jgit:org.eclipse.jgit.ssh.jsch.
because of the default ssh factory jsch move from jgit to org.eclipse.jgit:org.eclipse.jgit.ssh.jsch.
eclipse:jgit Use ServiceLoader to define the default SSH session factory
Hi, sorry for the delay here. I now finally had the time to add the dependency.
Could you perhaps try if this fixes the issue?
The version git-commit-id-plugin-4.0.5-20210317.082438-4 is available under https://oss.sonatype.org/content/repositories/snapshots/pl/project13/maven/git-commit-id-plugin/4.0.5-SNAPSHOT/ and should be available when adding the this snippet to your pom.
Thanks!
Assuming this is fixed with the additional dependency from https://github.com/git-commit-id/git-commit-id-maven-plugin/pull/547
For what is worth, I confirm the additional dependency fixes the issue!
Thanks! That certainly adds confidence that this issue doesn't come back :-)