Maven dependencies needed for Jersey 2.x (2.6)

后端 未结 1 1036
日久生厌
日久生厌 2020-12-11 02:07

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 does

相关标签:
1条回答
  • 2020-12-11 02:24

    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.

    0 讨论(0)
提交回复
热议问题