java javaee-api 和 javaee-web-api 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16789020/
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-11-01 00:01:09  来源:igfitidea点击:

What is the difference between javaee-api and javaee-web-api?

javaapi

提问by kevin847

I realise these dependencies are required for compiling against Java servlet specification, and so on, but I'm not clear on the differences between them, and when I should use one as opposed to the other.

我意识到根据 Java servlet 规范等进行编译需要这些依赖项,但我不清楚它们之间的区别,以及何时应该使用一个而不是另一个。

What is the difference between them? Is one a superset of the other?

它们之间有什么区别?一个是另一个的超集吗?

<dependency>
  <groupId>javax</groupId>
  <artifactId>javaee-api</artifactId>
  <version>6.0</version>
  <scope>provided</scope>
</dependency>

dependency>
  <groupId>javax</groupId>
  <artifactId>javaee-web-api</artifactId>
  <version>6.0</version>
  <scope>provided</scope>
</dependency>

回答by maba

The javaee-web-apiis supposed to support the Java EE Web Profile.

javaee-web-api应该支持的Java EE Web Profile的

Introduced in Java EE 6, the Web Profile radically streamlines the platform and enables the creation of a new dawn of lightweight, agile, compelling application servers with a laser focus on web application development.

在 Java EE 6 中引入的 Web Profile 从根本上简化了平台,使轻量级、敏捷、引人注目的应用程序服务器的新曙光得以创建,重点关注 Web 应用程序开发。

However if you compare the two different jar files there is little that differs between them. I opened them up in 7-zip and these two screenshots shows the only (AFAIK) differences, namely that there is no support for JMS in the javaee-web-apiandthat the xmllibrary seems to be larger in the javaee-api.

但是,如果您比较两个不同的 jar 文件,它们之间几乎没有什么不同。我打开了他们在7-ZIP和这两张截图显示了只(据我所知)的差异,即没有在对JMS不支持javaee-web-apixml库似乎在更大javaee-api

javaee-api

javaee-api

enter image description here

在此处输入图片说明

javaee-web-api

javaee-web-api

enter image description here

在此处输入图片说明