0

Continuation of 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"
}

After executing the jar task and running the jar, an error is thrown when trying to create JAX-RS requests:

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

This was deemed to be the result of conflicts of service files, resulting in only 1 being packaged. When using the ShadowJar plugin, the solution is to configure it with

shadowJar {
  mergeServiceFiles()
}

(see MessageBodyWriter not found error for Jersy / Jetty server), but this does not work for this plugin's jar generation.

How to resolve this conflict?

user1803551
  • 12,965
  • 5
  • 47
  • 74
  • There's a post [here](https://stackoverflow.com/q/58330729/2587435) that says it's using the two plugins alongside each other. They didn't state anything about the service files, but have you tried yet to use both of them together? – Paul Samsotha Sep 30 '20 at 19:11
  • @PaulSamsotha Not yet. I want to see if there's a solution without the additional plugin first. – user1803551 Sep 30 '20 at 19:41
  • @PaulSamsotha I checked, ShadowJar doesn't work with JavaFX>8 because of conflict with the modules. It's possible to bundle everything except JavaFX this way, and then use external JavaFX dependencies in runtime. Not ideal. – user1803551 Oct 01 '20 at 08:40

0 Answers0