A.3. 远程 Jakarta Enterprise Beans 客户端的项目依赖项
包括从远程客户端调用会话 Bean 的 Maven 项目需要来自 JBoss EAP Maven 存储库的下列依赖项:如下面的子章节中所述,有两种方法来声明 Jakarta Enterprise Beans 客户端依赖项。
artifactId 版本可能会有变化。有关最新版本,请参阅 JBoss EAP Maven 存储库。
远程 Jakarta 企业 Bean 客户端的 Maven 依赖项
jboss-eap-jakartaee8 Bill of Materials(BOM)打包了 JBoss EAP 应用通常需要的许多构件的正确版本。BOM 依赖项在 pom.xml 的 <dependencyManagement> 部分中 指定,其范围为 导入。
示例:POM 文件 <dependencyManagement> 部分
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.bom</groupId>
<artifactId>jboss-eap-jakartaee8</artifactId>
<version>7.4.0.GA</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
剩余的依赖项在 pom.xml 文件的 <dependencies> 部分中 指定。
示例:POM 文件 <dependencies> 部分
<dependencies>
<!-- Include the Enterprise Java Bean client JARs -->
<dependency>
<groupId>org.jboss.eap</groupId>
<artifactId>wildfly-ejb-client-bom</artifactId>
<type>pom</type>
</dependency>
<!-- Include any additional dependencies required by the application
...
-->
</dependencies>
JBoss EAP 随附的 ejb-remote 快速入门提供了远程 Jakarta 企业 Beans 客户端应用的完整工作示例。有关远程会话 Bean 调用的依赖配置的完整示例,请参见位于快速启动的根目录中的 client/pom.xml 文件。
用于 jboss-ejb-client 依赖项的单个 artifactID
您可以使用 wildfly-ejb-client-bom artifactID 并添加 jboss-ejb-client 库,以包含 Jakarta Enterprise Beans 客户端所需的所有依赖项:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.eap</groupId>
<artifactId>wildfly-ejb-client-bom</artifactId>
<version>JAKARTA_ENTERPRISE_BEANS_CLIENT_BOM_VERSION</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-ejb-client</artifactId>
</dependency>
</dependencies>您必须使用 JBoss EAP Maven 存储库中提供的 JAKARTA_ENTERPRISE_BEANS_CLIENT_BOM_VERSION。