有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

openjfx javafxplugin jar创建中的java多服务文件冲突

Which ReastEasy 4 client dependencies are needed?

build.gradle

plugins {
    id 'org.openjfx.javafxplugin'
    id 'java'
}

repositories {
    jcenter()
    mavenCentral()
}

sourceCompatibility = 14
targetCompatibility = 14

ext.resteasyVersion = "4.5.8.Final";

dependencies {
    compile "org.jboss.resteasy:resteasy-client:$resteasyVersion"
    compile "org.jboss.resteasy:resteasy-jackson2-provider:$resteasyVersion"
}

执行jar任务并运行jar后,在尝试创建JAX-RS请求时抛出错误:

javax.ws.rs.ProcessingException: RESTEASY003215: could not find writer for content-type application/json type: java.lang.String

这被认为是服务文件冲突的结果,导致只有1个被打包。使用ShadowJar插件时,解决方案是使用

shadowJar {
  mergeServiceFiles()
}

(请参见MessageBodyWriter not found error for Jersy / Jetty server),但这不适用于该插件的jar生成

如何解决这一冲突


共 (0) 个答案