How to modify dependency for Jersey projects built on Gradle?

I was attempting to solve problems of MessageBodyWriter not found in a Jersey project I created. I got a lot of recommendations fixing the dependency, some of which mention changing pom.xml, but since the project I got was built and compiled in Gradle, there are not similar xml like that. What are the similar files I need to look into in terms of checking dependency?

Answers


Maven → Gradle == <groupId>:<artifactId>:<version>

So

<dependency>
  <groupId>org.glassfish.jersey.media</groupId>
  <artifactId>jersey-media-json-jackson</artifactId>
  <version>${jersey2.version}</version>
  <scope>runtime</scope>
</dependency>

in Gradle would be

compile org.glassfish.jersey.media:jersey-media-json-jackson:${jersey2.version}

${jersey2.version} is whatever Jersey 2.x version you are using.

See Also:

Note: The above solution is for if you are getting a "MessageBodyReader nor found for application/json". Any other type, then you would need to show us the stacktrace. I am just stating the most common one (and that's what you have linked to), since you have not provided the exact stacktrace message. It could really be for any type, in which case this answer would be irrelevant. You might also find this useful. Just some general information about MessageBodyReaders and MessageBodyWriters


Take the data that you add to your pom and add it like this top your build file...

dependencies {
    compile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.7.Final'
}

You can copy the text of your pom file exactly.


Need Your Help

Shell script to extract app name

linux bash shell unix jenkins

I have Repo_URLs in Jenkins for various jobs which looks like:

WPF ListBox's scrollviewer customizable so that there is no Scrollbar, only RepeatButtons

c# .net wpf templates styles

I would like to customize the scrollbars of a listbox's scrollviewer in such a way that the scrollbar only consists of a RepeatButton for scrolling up and a Repeatbutton for scrolling down. Nothing...