Excluding Gradle plugin dependencies in submodules

I have two different gradle plugins, one in the root project, and another in a submodule. The thing is, I'm getting a reflection related stacktrace when loading the Gradle project which originates from a dependency (I think it was something like Jackson faster xml or something). Removing said plugin in the root project fixes this issue. My conclusion from that is that the plugin in the root project has a different version of that dependency than the one used by the plugin in the submodule. How do I exclude plugin dependencies in submodules? (Sorry for minimal information on that stacktrace, I'm traveling at the moment)
7 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @Thorinwasher! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Thorinwasher
ThorinwasherOP2mo ago
I have found this https://stackoverflow.com/questions/56412868/exclude-transitive-dependency-of-gradle-plugin, but it feels more like that is for a different application. I'm quite unsure how the Gradle project java runtime works though (I think it's at least a java runtime)
Stack Overflow
Exclude transitive dependency of Gradle plugin
Excluding a transitive dependency in Gradle is pretty straightforward: compile('com.example.m:m:1.0') { exclude group: 'org.unwanted', module: 'x' } How would we go around he situation in ...
JavaBot
JavaBot2mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Thorinwasher
ThorinwasherOP2mo ago
The exception I am getting on compile is this:
Caused by: java.lang.NoSuchMethodError: 'void com.fasterxml.jackson.core.base.GeneratorBase.<init>(int, com.fasterxml.jackson.core.ObjectCodec, com.fasterxml.jackson.core.io.IOContext)'
at com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.<init>(YAMLGenerator.java:299)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createGenerator(YAMLFactory.java:532)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createGenerator(YAMLFactory.java:491)
at com.fasterxml.jackson.databind.ObjectMapper.createGenerator(ObjectMapper.java:1230)
at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3906)
at net.minecrell.pluginyml.GeneratePluginDescription.generate(GeneratePluginDescription.kt:73)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
Caused by: java.lang.NoSuchMethodError: 'void com.fasterxml.jackson.core.base.GeneratorBase.<init>(int, com.fasterxml.jackson.core.ObjectCodec, com.fasterxml.jackson.core.io.IOContext)'
at com.fasterxml.jackson.dataformat.yaml.YAMLGenerator.<init>(YAMLGenerator.java:299)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory._createGenerator(YAMLFactory.java:532)
at com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createGenerator(YAMLFactory.java:491)
at com.fasterxml.jackson.databind.ObjectMapper.createGenerator(ObjectMapper.java:1230)
at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3906)
at net.minecrell.pluginyml.GeneratePluginDescription.generate(GeneratePluginDescription.kt:73)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
And, I tried doing this, but I still get the same stacktrace on compile:
configurations {
all {
resolutionStrategy {
force("com.fasterxml.jackson.core:jackson-core:2.18.2")
}
}
}
configurations {
all {
resolutionStrategy {
force("com.fasterxml.jackson.core:jackson-core:2.18.2")
}
}
}
(This is the version that should be compatible with de.eldoria.plugin-yml.bukkit, and the above code is in the module that uses that plugin, I also tried doing this in the root project to no avail) The plugins that are conflicting are id("net.neoforged.gradle.common") version "7.0.181" and id("de.eldoria.plugin-yml.bukkit") version "0.7.1" Also, when I looked into it, it seems like this constructor did not exist before the version com.fasterxml.jackson.core:jackson-core:2.16, so the supplied dependency is lower than that version, which makes me confused, as per documentation I see that it should resolve to the latest version of any dependency when there is a conflict
JavaBot
JavaBot2mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Thorinwasher
ThorinwasherOP2mo ago
Found the solution:
buildscript {
configurations.all {
resolutionStrategy {
force("com.fasterxml.jackson.core:jackson-core:2.18.2")
}
}
}
buildscript {
configurations.all {
resolutionStrategy {
force("com.fasterxml.jackson.core:jackson-core:2.18.2")
}
}
}
On top of the build.gradle.kts file, before the plugins segment. Thanks myself 🥰
JavaBot
JavaBot2mo ago
Post Closed
This post has been closed by <@270177852157067264> for the following reason:
Figure it out myself

Did you find this page helpful?