问题
I imported a Dropwizard
project into Intellij IDEA
(using Gradle Wrapper
from the project itself). Its working for others, but I end up in issue like this:
Here is the gist of gradle dependency.
https://gist.github.com/vineelya/d882bbd0885fafba785ca58f106dfc8b
Exception in thread "main" java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
dependencies {
compile (
'io.dropwizard:dropwizard-core:' + dropwizardVersion,
'io.dropwizard:dropwizard-hibernate:' + dropwizardVersion,
'io.dropwizard:dropwizard-migrations:' + dropwizardVersion,
'io.dropwizard:dropwizard-auth:' + dropwizardVersion,
'io.dropwizard:dropwizard-assets:' + dropwizardVersion,
'io.dropwizard:dropwizard-forms:'+ dropwizardVersion,
回答1:
You have two dependencies which are importing older versions of Jackson Core
.
com.amazon.alexa:alexa-skills-kit:1.2
com.google.api-client:google-api-client:1.19.1
While Gradle should always pick up the latest version, this might be causing your error.
Therefore, exclude them using
implementation('com.amazon.alexa:alexa-skills-kit:1.2') {
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
}
implementation('com.google.api-client:google-api-client:1.19.1') {
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
}
Or, update them to a compatible, maybe the latest, version (e.g. see MavenCentral).
To force the resolution of a specific version, you can use
configurations.all {
resolutionStrategy {
force 'com.fasterxml.jackson.core:jackson-core:2.8.8'
}
}
来源:https://stackoverflow.com/questions/55009341/issues-with-dropwizard-gradle-build