什么 Maven 工件包含 javax.ws.rs.Path?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18139029/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 22:40:47  来源:igfitidea点击:

What Maven Artifact Contains javax.ws.rs.Path?

javamavenjax-rs

提问by David Williams

I am working through examples in Restful Java with JAX-RS by Bill Burke. I'm using intellij and created a Maven project to make a "Hello World" web service. I understand that JAX-RS is a specification, and not an implementation. I would like to try the Apache CXF implementation.

我正在通过 Bill Burke 使用 JAX-RS 研究 Restful Java 中的示例。我正在使用 intellij 并创建了一个 Maven 项目来制作“Hello World”Web 服务。我知道 JAX-RS 是一个规范,而不是一个实现。我想尝试 Apache CXF 实现。

How do I find out what jar, or what Maven artifact contains the necessary classes to:

我如何找出什么 jar 或什么 Maven 工件包含必要的类:

import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.GET;

采纳答案by chrylis -cautiouslyoptimistic-

Try searching for the class on Central. It looks like jaxrs-apiis what you're looking for; there are a couple of different packagers, and which one you want is probably whichever goes with your container.

尝试在Central上搜索课程。看起来jaxrs-api就是你要找的东西;有几个不同的包装器,您想要的可能是与您的容器搭配的那个。

回答by Zac

g:"javax.ws.rs" AND a:"jsr311-api"

g:"javax.ws.rs" 和 a:"jsr311-api"

http://search.maven.org/

http://search.maven.org/

回答by Vivek Bansal

Add below lines in pom.xml

在 pom.xml 中添加以下几行

<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>javax.ws.rs-api</artifactId>
    <version>2.0</version>
</dependency>