Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicts on JGit transitive dependency version #643

Closed
I-Vargas opened this issue Jul 13, 2020 · 3 comments
Closed

Conflicts on JGit transitive dependency version #643

I-Vargas opened this issue Jul 13, 2020 · 3 comments
Labels

Comments

@I-Vargas
Copy link

I-Vargas commented Jul 13, 2020

I was trying to add spotless 5.0.0 to a project but it gave me an error, and I tried other versions and I saw that it failed for versions 4.5.0 and newer.

Software version:

  • spotless 4.5.0+
  • pl.allegro.tech.build.axion-release 1.12.0
  • gradle 6.5.1
  • macOs Mojave (10.14.6)

It fails when I add the plugin to the plugins block.

ERROR: Unable to load class 'org.eclipse.jgit.transport.JschConfigSessionFactory'.

In version 4.5.0 the JGit dependency was updated from 5.7 to 5.8 (commit link) while axion is still using version 5.7.

I also saw that there is an Issue #587 that seems to touch on this subject.

This issue has also been reported on the axion repo (issue link).

Result of gradlew spotlessCheck --stacktrace:

* Exception is:
java.lang.NoClassDefFoundError: org.eclipse.jgit.transport.JschConfigSessionFactory
        at pl.allegro.tech.build.axion.release.infrastructure.git.GitRepository.<init>(GitRepository.java:28)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at pl.allegro.tech.build.axion.release.infrastructure.di.ScmRepositoryFactory.create(ScmRepositoryFactory.groovy:23)
        at pl.allegro.tech.build.axion.release.infrastructure.di.ScmRepositoryFactory$create.call(Unknown Source)
        at pl.allegro.tech.build.axion.release.infrastructure.di.GradleAwareContext.create(GradleAwareContext.groovy:15)
        at pl.allegro.tech.build.axion.release.infrastructure.di.GradleAwareContext$create.call(Unknown Source)
        at pl.allegro.tech.build.axion.release.domain.VersionConfig.ensureContextExists(VersionConfig.groovy:167)
        at pl.allegro.tech.build.axion.release.domain.VersionConfig.getUncachedVersion(VersionConfig.groovy:155)
        at pl.allegro.tech.build.axion.release.domain.VersionConfig_Decorated.getUncachedVersion(Unknown Source)
        at pl.allegro.tech.build.axion.release.domain.VersionConfig.ensureVersionExists(VersionConfig.groovy:150)
        at pl.allegro.tech.build.axion.release.domain.VersionConfig.getVersion(VersionConfig.groovy:130)
        at pl.allegro.tech.build.axion.release.domain.VersionConfig_Decorated.getVersion(Unknown Source)
        at Build_gradle.<init>(build.gradle.kts:51)
        at Program.execute(Unknown Source)
        at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.eval(Interpreter.kt:502)
        at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.evaluateSecondStageOf(Interpreter.kt:418)
        at Program.execute(Unknown Source)
        at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.eval(Interpreter.kt:502)
        at org.gradle.kotlin.dsl.execution.Interpreter.eval(Interpreter.kt:200)
        at org.gradle.kotlin.dsl.provider.StandardKotlinScriptEvaluator.evaluate(KotlinScriptEvaluator.kt:119)
        at org.gradle.kotlin.dsl.provider.KotlinScriptPluginFactory$create$1.invoke(KotlinScriptPluginFactory.kt:51)
        at org.gradle.kotlin.dsl.provider.KotlinScriptPluginFactory$create$1.invoke(KotlinScriptPluginFactory.kt:36)
        at org.gradle.kotlin.dsl.provider.KotlinScriptPlugin.apply(KotlinScriptPlugin.kt:34)
        at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69)
      (... a bunch supress here)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jgit.transport.JschConfigSessionFactory
        ... 148 more
@nedtwigg
Copy link
Member

Thanks for sharing. I'm surprised that Gradle can't handle 5.7 and 5.8. You are correct that #587 would be a resolution. Another option would be to futz with something like this:

buildscript {
  configurations.classpath {
    resolutionStrategy {
      force 'org.eclipse.jgit:org.eclipse.jgit:5.7.0.202003110725-r'
    }
  }
}

@I-Vargas
Copy link
Author

Thanks for sharing. I'm surprised that Gradle can't handle 5.7 and 5.8. You are correct that #587 would be a resolution. Another option would be to futz with something like this:

buildscript {
  configurations.classpath {
    resolutionStrategy {
      force 'org.eclipse.jgit:org.eclipse.jgit:5.7.0.202003110725-r'
    }
  }
}

It does indeed work as a workaround.

@nedtwigg nedtwigg changed the title Can't use spotless 4.5.0+ Conflicts on JGit transitive dependency version Jul 13, 2020
@nedtwigg
Copy link
Member

I'm gonna close as dupe of #587, since that is likely the only long-term fix for this recurrent issue. Happy to revisit if new info emerges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants