bytedeco / gradle-javacpp

Gradle plugins to automate the build process of JavaCPP and JavaCV
Other
57 stars 20 forks source link

getOriginalMetadata() missing in Gradle 7.6 #28

Closed petebankhead closed 1 year ago

petebankhead commented 1 year ago

I've found this extremely useful, but upgrading to Gradle 7.6 today resulted in a large number of messages

Could not get the classifier of org.bytedeco:javacpp:1.5.8: java.lang.NoSuchMethodException: org.gradle.api.internal.artifacts.repositories.resolver.AbstractDependencyMetadataAdapter.getOriginalMetadata()

and jars for all the platforms being downloaded.

As far as I can tell, the problem is that AbstractDependencyMetadataAdapter.getOriginalMetadata() was removed in this commit: https://github.com/gradle/gradle/commit/ad1cc1c90b71bbf5813e7c3dcf87672a15ed932f

The good news (I hope) is that there's now a public AbstractDependencyMetadataAdapter.getMetadata().

saudet commented 1 year ago

If it works, please open a pull request!

petebankhead commented 1 year ago

Thanks @saudet it might take a little while before I can look into it and understand the tests (which don't show any failures even with 7.6).

The relevant bit of the code is https://github.com/bytedeco/gradle-javacpp/blob/1.5.8/src/main/java/org/bytedeco/gradle/javacpp/PlatformRule.java#L73

From that it looks like you already have a solution for Gradle 6.3+ that's commented out, it's just that the workaround to support earlier versions of Gradle now fails for 7.6+.

How important is it that the plugin supports Gradle before 6.3 (released March 2020)?

saudet commented 1 year ago

Maybe we can just put that code in a NoSuchMethodException catch block? Could you give that a try? The tests don't test a lot, that could also be improved...

saudet commented 1 year ago

Or maybe the other way around, we could put the workaround code for older versions of Gradle in a catch block. Which way do you prefer?

petebankhead commented 1 year ago

Putting the workaround code in a catch block sounds better to me. I should have more time to try in a week or two, unless someone else has already solved it by then.

saudet commented 1 year ago

Done in commit https://github.com/bytedeco/gradle-javacpp/commit/9098dcd4f20bb2ca50fa796a4dba2d48607bb845. Thanks for reporting!

petebankhead commented 1 year ago

Great, thanks!

johypark97 commented 1 year ago

It works. I came here last weekend with the same problem, and I think it is solved. That messages are not displayed anymore, and the jar files also are generated well. Also, It builds well on Gradle 7.6 + JDK LTS (8, 11, 17). Thank you!

dmcmahon2020 commented 1 year ago

Hi i'm still getting messages when upgrading to gradle 7.5 > 7.6

Could not get the classifier of org.bytedeco:javacv:1.5.7: java.lang.NoSuchMethodException: org.gradle.api.internal.artifacts.repositories.resolver.AbstractDependencyMetadataAdapter.getOriginalMetadata()

saudet commented 1 year ago

@dmcmahon2020 It hasn't been released yet, please try with the snapshots: http://bytedeco.org/builds/

dmcmahon2020 commented 1 year ago

@saudet thank you :)

dmcmahon2020 commented 1 year ago

@saudet when can we expect release?

saudet commented 1 year ago

The last release is only 2 months old, so not before a few months. BTW, reporting issues just after releases is not helpful, so if you have other issues, make sure to report them before releases, not after.

estigma88 commented 1 year ago

Any update on this issue? snapshot works fine

saudet commented 1 year ago

Version 1.5.9 has been released. Enjoy!

saudet commented 1 year ago

BTW, did anyone test this with Gradle 8.x?

estigma88 commented 1 year ago

Yes, my project is on 8.1, working well