DropWizard Gradle构建的问题 [英] Issues with DropWizard Gradle build

查看:95
本文介绍了DropWizard Gradle构建的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 Dropwizard 项目导入到 Intellij IDEA (使用 Gradle Wrapper 来自项目本身)。它对其他人有用,但我最终遇到这样的问题:

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:

这是gradle依赖的要点。

https://gist.github.com/vineelya/d882bbd0885fafba785ca58f106dfc8b
线程 main java.lang中的异常.NoSuchMethodError:com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z

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,


推荐答案

您有两个依赖项,这些依赖项会导入 Jackson Core 的旧版本。

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

虽然Gradle应该始终选择最新版本,但这可能会导致您出错。

因此,使用

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'
}

或者,将它们更新为兼容的,也许是最新版本(例如参见 MavenCentral )。

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'
    }
}

这篇关于DropWizard Gradle构建的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆