Wildfly 17服务器提供的Maven依赖关系 [英] Maven dependencies provided by wildfly 17 server

查看:88
本文介绍了Wildfly 17服务器提供的Maven依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用版本17的wildfly服务器,却陷入了pom文件中应提及的依赖关系的问题.

I just started using wildfly server version 17 and I got stuck looking into the dependencies that I should mention as provided in my pom file.

我没有在文档中找到任何东西来显示所提供的依赖及其正确版本.

I haven't found any thing in the documentation that shows the provided dependencies with their proper versions.

作为一个例子,这就是我想要的:

As an example here is what I want:

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

我想知道我从哪里获得服务器提供的所有依赖关系,以供将来使用.

I want to know where i get all the dependencies that are provided by the server for future use.

推荐答案

我陷入了我应该提到的依赖关系 在我的pom文件中

i got stuck about the dependencies that i should mention as provided in my pom file

您需要在 pom.xml 中添加的是问题中显示的<dependency>.

All you need to include in your pom.xml is the <dependency> shown in your question.

要清楚一点,您通常不需要或不需要获取所有依赖项" .您所需要做的就是使代码根据EE 7 API的Web配置文件进行编译,而您问题中的<dependency>将实现此目的.通过指定<scope>provided</scope>,您明确表示目标运行时(在您的情况下为Wildfly 17)将提供所需的Java EE代码,并且不应包含在应用程序的 war 文件中.

To be clear, you don't usually want or need to "get all the dependencies". All you need is for your code to compile against the Web profile of the EE 7 API, and the <dependency> in your question will achieve that. By specifying <scope>provided</scope> you are explicitly stating that the target runtime, Wildfly 17 in your case, will be providing the required Java EE code, and should not be included in your application's war file.

如果您确实在应用程序的 war 文件中包含任何EE代码,则在加载应用程序时,Wildfly服务器上可能会出现类加载器冲突.

And if you did include any EE code in your application's war file you might get class loader conflicts on the Wildfly server when your application is loaded.

有关更多信息,请参见 Java EE 7中唯一需要的依赖项.

See The Only One Dependency You Need In Java EE 7 for more information.

我在文档中没有发现任何内容 提供了具有正确版本的依赖项.

I haven't found any things in the documentation that shows the provided dependencies with their proper versions.

EE 7中的Web配置文件的内容在JSR-000342和

The content of the Web profile in EE 7 is formally defined in JSR-000342, and from here you can view or download the document WebProfile.pdf. Page 15 provides the information you want for EE 7 Web profile:

The following technologies are required components of the Web Profile:
• Servlet 3.1
• JavaServer Pages (JSP) 2.3
• Expression Language (EL) 3.0
• Debugging Support for Other Languages (JSR-45) 1.0
• Standard Tag Library for JavaServer Pages (JSTL) 1.2
• JavaServer Faces (JSF) 2.2
• Java API for RESTful Web Services (JAX-RS) 2.0
• Java API for WebSocket (WebSocket) 1.0
• Java API for JSON Processing (JSON-P) 1.0
• Common Annotations for the Java Platform (JSR-250) 1.2
• Enterprise JavaBeans (EJB) 3.2 Lite
• Java Transaction API (JTA) 1.2
• Java Persistence API (JPA) 2.1
• Bean Validation 1.1
• Managed Beans 1.0
• Interceptors 1.2
• Contexts and Dependency Injection for the Java EE Platform 1.1
• Dependency Injection for Java 1.0

我想知道我从哪里获得了由...提供的所有依赖项 服务器以备将来使用.

I want to know where i get all the dependencies that are provided by the server for future use.

如果要获取Java EE某些特定组件的代码:

If you want to get the code for some specific component of Java EE:

  • Find a list the individual components for the given EE version and profile. Use the list shown above for EE 7 Web profile, or Wikipedia which conveniently lists the components and their versions for Web profile for EE 6, EE 7 and EE 8.
  • For whatever EE component/version you want, just search on Maven's website, and click the jar link to download the appropriate jar file.

例如:

  • JSR-000342和Wikipedia显示EE 7 Web 配置文件使用 Bean验证的1.1版.
  • 在Maven网站上搜索 Bean验证 ,然后从Bean Validation API页面显示的版本列表中,单击指向所需特定版本的链接.在您的情况下,可能是 1.1.0.Final .
  • Bean验证API»1.1.0.Final 页面上,单击 jar 链接以下载名为 jar 文件. validation-api-1.1.0.Final.jar .您还可以将所需的<dependency>复制到剪贴板.
  • JSR-000342 and Wikipedia show that EE 7 Web profile uses version 1.1 of Bean Validation.
  • Search on Maven's web site for Bean Validation, and from the list of versions shown ion the Bean Validation API page, click the link to the specific version you want. In your case that would probably be 1.1.0.Final.
  • On the page for Bean Validation API » 1.1.0.Final click the jar link to download the jar file named validation-api-1.1.0.Final.jar. You can also copy the required <dependency> to the clipboard.

这篇关于Wildfly 17服务器提供的Maven依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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