Jersey 2.x (2.6) 所需的 Maven 依赖项 [英] Maven dependencies needed for Jersey 2.x (2.6)

查看:40
本文介绍了Jersey 2.x (2.6) 所需的 Maven 依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Jersey 1.x (1.2) 迁移到 2.x (2.6),我无法确定确切的 maven 依赖项,jersey 文档不够全面,它没有提到什么是 maven 依赖项新版本需要.

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.

是否有人拥有 Jersey 2.x (2.6) 所需的 maven 依赖项的完整列表?

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

泽西文档https://jersey.java.net/documentation/latest/migration.html#mig-1.x

推荐答案

对于一个servlet环境,你唯一需要的依赖是

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>

这将满足您的所有需求.如果您在 servlet 2.5 环境中,那么您将使用它来代替

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>

关于 2.5 servlet 的更多信息,可以查看这里

Further information about 2.5 servlet, can be seen here

或者,您可以从 Maven 原型创建项目,如 here

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

请注意,使用 Jersey 2.6 的意义在于它是支持 Java 6 的最后一个版本.如果这不是您的要求,我建议使用 最新版本.

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.

这篇关于Jersey 2.x (2.6) 所需的 Maven 依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆