JAX-RS in IDEA

Answered

Hi!

Can you please help me with creating a JAX-RS project without using maven?

It would seem that all I need to do is to choose Restful web service support in module creation, but when I do that, I always seem to have problems with dependencies. Actually I could choose to download Jersey 2.2 jars automatically, but in my school, we use WildFly9 server, and all of the libraries needed should be included with the server. So I figured out that in Project Structure -> Modules -> Dependencies, JBoss9 library is added automatically when I create a module, and it has a scope "provided", and I'm guessing that it means that the implementations are provided by the server at runtime. But still when I try to extend the javax.ws.rs.core.Application it can't resolve it. I tried to add it manually to the JBoss library but I get errors when I try to deploy the project.

Thank you!

2 comments

What errors do you get on deployment? Maybe this module is not loaded by JBoss?

0

Thank you for a fast reply!

I just tried to edit the JBoss Application server library, and manually added two jars, both jax-rs api and resteasy and it actually works. It seems, due to my noobness in the matter, last time I tried to add only the API jars and that's why it didn't work.

But still it seems really inconvenient to search for the dependencies in the "wildfly-9.0.2.Final\modules\system\layers\base" folder every time I want to add a framework support. I'm pretty sure that I'm doing it wrong. When creating a project, IDEA automatically catches three jars from there, and I'm wondering why only three of them?

Is there a way to automatically import all the needed dependencies bundled with the server? In my school the teacher uses Eclipse, and all he has to do is select something like "library provided by target runtime" and Eclipse catches all the needed jars from the WildFly library.

0

Please sign in to leave a comment.