12

I'm trying to migrate from Jersey 1.x (1.2) to 2.x (2.6), I have trouble identifying the exact maven dependencies, jersey documentation is not comprehensive enough, it doesn't mention what maven dependencies are needed for the new version.

Does anyone have comprehensive list of maven dependencies needed for Jersey 2.x (2.6)?

Jersey doc https://jersey.java.net/documentation/latest/migration.html#mig-1.x

Jack
  • 1,250
  • 1
  • 14
  • 26
Asela Senanayake
  • 351
  • 2
  • 6
  • 21

1 Answers1

15

For a servlet environment, the only dependency you need is

<dependency>
    <groupId>org.glassfish.jersey.containers</groupId>
    <artifactId>jersey-container-servlet</artifactId>
    <version>2.6</version>
</dependency>

This will pull in all you need. If you are in a servlet 2.5 environment, then you would use this instead

<dependency>
    <groupId>org.glassfish.jersey.containers</groupId>
    <artifactId>jersey-container-servlet-core</artifactId>
    <version>2.6</version>
</dependency>

Further information about 2.5 servlet, can be seen here

Alternatively, you could create a project from a Maven archetype, as seen here

UPDATE

Just as a note, the significance of using Jersey 2.6 is that it is the last version to support Java 6. If this is not a requirement for you, I would recommend using the latest version.

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
  • 2
    Based on what your requirement you can add other dependencies from following list. https://jersey.java.net/documentation/2.6/user-guide.html#modules – Asela Senanayake Jan 14 '15 at 02:48
  • Thank you! It's just me or it is still hard to find the minimal for Jersey 2? This worked fine for me, along with jersey-hk2. These 2 dependencies are enough to run my services. – jfajunior Sep 11 '18 at 14:52