此内容没有您所选择的语言版本。

3.5.3. Packaging A Service


After testing your service, it is time to package it up so that others can use it. The simplest way to do this is to create a JAR containing all of the classes. You can choose to include the deployment descriptor if there is a sensible default way to configure the service, but this is optional.

Procedure 3.1. Packaging a Service

  1. Place the deployment descriptor in the META-INF directory (optional)

    If you do choose to include the deployment descriptor, by convention it should be named jboss-beans.xml and should be placed in a META-INF directory. This is the default layout for the Enterprise Platform, so the JAR deployer recognizes this layout and automatically performs the deployment.
    The deployment descriptor is not included in the Human Resources example, because the service is configured by editing the descriptor directly, as a separate file.
  2. Generate the JAR

    To generate a JAR containing all of the compiled classes, enter mvn package from the humanResourcesService/ directory.
  3. Make the JAR available to other Maven projects

    To make the JAR available to other Maven projects, enter mvn install in order to copy it to your local Maven repository. The final layout of the JAR is shown in Example 3.3, “Listing of the org/jboss/example/service and META-INFDirectories”.

Example 3.3. Listing of the org/jboss/example/service and META-INFDirectories

`-- org
    `-- jboss
        `-- example
            `-- service
                |-- Address.java
                |-- Employee.java
                |-- HRManager.java
                `-- util
                    |-- AgeBasedSalaryStrategy.java
                    |-- LocationBasedSalaryStrategy.java
                    `-- SalaryStrategy.java
`--META-INF
    `-- MANIFEST.MF
    `-- maven
        `-- org.jboss.micrcontainer.examples
	        `-- humanResourceService
Copy to Clipboard Toggle word wrap

Note

The META-INF/maven directory is automatically created by Maven, and will not be present if you are using a different build system.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat