JAX-RS jersey with gradle not working

I want to use JAX-RS jersey with gradle . It works perfectly fine with Maven via Springtool suite. But when i tried converting my maven simple jax-rs project to gradle , it doesn’t work. I am pretty sure I am missing some properties or setting . It will be great if anyone can point it out how my build.gradle should look like.

I get 404 error .

my pom.xml in maven :


org.glassfish.jersey.containers jersey-container-servlet-core org.glassfish.jersey.media jersey-media-moxy org.apache.cxf cxf-bundle-jaxrs 2.7.7


Learn this lesson now: If you’re asking for help with any sort of program that “doesn’t work”, it is completely impossible for anyone to help you unless you show exactly what you’ve done so far and you are explicit about what “doesn’t work” means. In short, show your “build.gradle” file and any other project-specific aspects, and show the exact outputs or error messages that indicate that this “doesn’t work”.

Hey David. i get your point . The very reason i didn’t write my build script is because i needed a fresh perspective based on my pom.xml .
But yes, i get your point of view too from the fact that you wanted to help me and just couldn’t due to insufficient info. thanks a lot for taking a look at it .

I got my code working with below build script , i was missing jackson dependencies and a hook for it in my java code . Not sure why i needed this dependency in gradle and explicit hook since i didn’t have it in Maven.

To get JAX-RS work in STS + gradle , I have below code :


// Apply the java plugin to add support for Java
plugins {
id ‘war’ //implies java
id ‘eclipse-wtp’ //implies eclipse. needed to run on tomcat server instance inside STS ide.

// In this section you declare where to find the dependencies of your project
repositories {
// You can declare any Maven/Ivy/file repository here.



// In this section you declare the dependencies for your production and test code
dependencies {
//compile ‘log4j:log4j:1.2.17’
//compile 'org.springframework:spring-webmvc:4.2.3.RELEASE’
compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.22.1’
compile ‘org.glassfish.jersey.media:jersey-media-json-jackson:2.22.1’


My java code:
public class HelloWorld {

public String helloWorld(@PathParam("example") String example) {
    System.out.println("Method helloWorld with example path called.");
    return example + " recieved!";


public class JerseyApplication extends ResourceConfig {
public JerseyApplication() {