Reputation: 12896
We're running a project which is deployed as several WARs in a WildFly 20 server. The project setup is horrible due to "historic reasons", i.e. there are several pom.xml
files with dependencies all over the place.
Now I'm about to build a new WAR module which shall provide a REST API based on JAX-RS. As I can start from scratch, I'd like to keep the pom.xml
as simple as possible by using the libraries which WildFly 20 already provides.
This is a sample controller:
SampleController.java
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
public class SampleController {
@GET
public Response ping() {
return Response.ok().entity("pong").build();
}
}
It seems as if the following is working:
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
But this is also working...
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>${jakartaee.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
And then I'm reading about including wildfly-jaxrs
and other artifacts...
So, which dependencies do I really need specififcally for implementing REST services with JAX-RS?
Upvotes: 0
Views: 860
Reputation: 17780
Since you're using a Jakarta EE Compatible server, WildFly, the API is all you would need as a dependency. The dependency should also be marked as <scope>provided</scope>
.
Given this is a new application I'd lean towards using the Jakarta EE dependencies.
Upvotes: 1