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

NoSuchMethodError #9

Closed
hanetzer opened this issue Apr 12, 2016 · 10 comments
Closed

NoSuchMethodError #9

hanetzer opened this issue Apr 12, 2016 · 10 comments

Comments

@hanetzer
Copy link

org.eclipse.jgit.api.DescribeCommand.setLong(Z)Lorg/eclipse/jgit/api/DescribeCommand
Not sure what's wrong here. full log

@MicahZoltu
Copy link
Member

I haven't seen that error before. Is the repository you are trying to use this with public so I can try to reproduce? What version of Gradle are you using? Are you using any other plugins that interact with git?

Caused by: java.lang.NoSuchMethodError: org.eclipse.jgit.api.DescribeCommand.setLong(Z)Lorg/eclipse/jgit/api/DescribeCommand;
    at com.zoltu.gradle.plugin.GitVersioning.getGitDescribeResults(GitVersioning.kt:53)

@MicahZoltu
Copy link
Member

The only thing I can think of that would cause that error is if the wrong version of jgit was used when the plugin tried to run. The method in question setLong was added to jgit about a year ago in this commit: https://github.com/eclipse/jgit/commit/0e3ddea1b028836889fc13ad56b1dec5d5438fc9

I don't know exactly how Gradle plugins pull in dependencies, I assumed that they were hard-linked but maybe you have another plugin with an older version of jgit that is overriding the version this plugin references? If jgit were missing entirely then the error would have occurred earlier in execution.

@MicahZoltu
Copy link
Member

If your source code isn't public, would you be able to share your build.gradle with me? I may be able to poke through that and see if anything stands out and/or get a repro case created.

@hanetzer
Copy link
Author

there really isn't much to the build.gradle, and the source code will be public, but at the moment I'm just setting up

@MicahZoltu
Copy link
Member

buildscript {
    repositories {
        jcenter()
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        // THIS LINE BELOW IS THE KEY
        classpath "org.eclipse.jgit:org.eclipse.jgit:4.3.0.201604071810-r"
        // THE LINE ABOVE IS THE KEY
        classpath "gradle.plugin.com.zoltu.gradle.plugin:git-versioning:2.0.12"
    }
}

It appears that the net.minecraftforge.gradle.forge or one of its dependencies plugin has bundled in an old version of jgit that doesn't have the DescribeCommand.setLong() method. When the git-versioning plugin tries to call that method, it fails to find it because it sees the copy of DescribeCommand that is coming in via net.minecraftforge.gradle.forge or one of its dependencies.

By adding a reference to org.eclipse.jgit to the classpath, you can force gradle to use the version of the DescribeCommand class found in that dependency, rather than whatever is getting pulled in transitively.

@hanetzer
Copy link
Author

ok, question: What is this 'KEY' you're mentioning above?

@MicahZoltu
Copy link
Member

Sorry, I just meant that the line between the comments is what fixes the issue. "Key to solving the problem"

@hanetzer
Copy link
Author

Ah gotcha. I'm filing a bug against MinecraftForge/Srg2Source#11

@MicahZoltu
Copy link
Member

To be clear, I'm not sure that is the issue, just a guess. All I know it's that the plugin is pulling in an old version of jgit.

@MicahZoltu
Copy link
Member

I'm closing this issue out. It appears that the linked MinecraftForge issue was resolved, so hopefully everything is now working for you!

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

No branches or pull requests

2 participants