6.3. 使用 Maven 插件置备 JBoss EAP 服务器


使用 Maven 插件更新应用的 pom.xml,将其与一起打包并部署到自定义调配的 JBoss EAP 服务器上。然后,您可以在 OpenShift 上的自定义置备的 JBoss EAP 服务器上部署应用。

先决条件

  • 确保 JBoss EAP Maven 插件和 JBoss EAP Maven 构件可从您的本地或远程 Maven 存储库访问。
  • 您已安装了 JDK 21。
  • 您已安装了 Maven。如需更多信息,请参阅 下载 Apache Maven

    注意

    如果您使用 JDK 17 和 Maven 3.8.5 或更早版本的 Maven 版本,请使用最新的 Maven WAR 插件。

  • 您已为 Jakarta EE 10 应用创建了 Maven 项目。如需更多信息,请参阅使用 Maven 创建 Jakarta EE 10 应用

流程

  1. 通过将以下内容添加到 pom.xml 文件中,将 Maven 配置为从远程存储库检索 JBoss EAP BOM 和 JBoss EAP Maven 插件:

    <repositories>
        <repository>
            <id>jboss</id>
            <url>https://maven.repository.redhat.com/ga/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>jboss</id>
            <url>https://maven.repository.redhat.com/ga/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
    Copy to Clipboard Toggle word wrap
  2. pom.xml 文件的 <build > 元素中添加以下内容。例如:

    <plugins>
        <plugin>
            <groupId>org.jboss.eap.plugins</groupId>
            <artifactId>eap-maven-plugin</artifactId>
            <version>1.0.0.Final-redhat-00014</version> 
    1
    
            <configuration>
                <channels>
                    <channel>
                        <manifest>
                            <groupId>org.jboss.eap.channels</groupId> 
    2
    
                            <artifactId>eap-8.0</artifactId>
                        </manifest>
                    </channel>
                </channels>
                <feature-packs>
                    <feature-pack>
                        <location>org.jboss.eap:wildfly-ee-galleon-pack</location> 
    3
    
                    </feature-pack>
                    <feature-pack>
                        <location>org.jboss.eap.cloud:eap-cloud-galleon-pack</location> 
    4
    
                    </feature-pack>
                </feature-packs>
                <layers>
                    <layer>cloud-server</layer> 
    5
    
                </layers>
                <runtime-name>ROOT.war</runtime-name> 
    6
    
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>package</goal> 
    7
    
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    Copy to Clipboard Toggle word wrap
    1
    <version>1.0.0.Final-redhat-00014</version > 是 JBoss EAP Maven 插件的示例版本。有关 JBoss EAP Maven 插件发行版本的更多信息,请参阅 Red Hat Maven 存储库: https://maven.repository.redhat.com/earlyaccess/all/org/jboss/eap/plugins/eap-maven-plugin/
    2
    这将指定定义 JBoss EAP 服务器工件的 JBoss EAP 8.0 频道。
    3
    您可以从 JBoss EAP 频道检索此功能 pack 的版本。Galleon 功能包 包括 Galleon 层,如用于置备修剪 JBoss EAP 服务器的 cloud-server
    4
    此功能软件包调整了云的服务器 Galleon 层。需要使用此功能软件包为 OpenShift 构建应用程序。
    5
    此 Galleon 层使用在云中运行 JBoss EAP 应用程序时所需的功能置备服务器。
    6
    使用这个配置选项,您可以在 HTTP 根上下文中注册部署。
    7
    借助此插件目标,您可以调配服务器、部署应用程序、应用自定义 CLI 脚本,并将自定义内容复制到服务器安装中。
  3. 打包应用。

    $ mvn package
    Copy to Clipboard Toggle word wrap

    目录 target/server 包含可用于调试或开发目的的服务器和应用程序。在 JBoss EAP S2I 构建上下文中,由 JBoss EAP maven-plugin 调配的服务器安装在 /opt/server 位置的 JBoss EAP 镜像中。如需更多信息,请参阅在 OpenShift 中使用 Source-to-Image (S2I)构建应用程序镜像

注意

如果您使用启用了调试的 mvn package 命令(-X 选项),请包含属性 -Dorg.slf4j.simpleLogger.log.com.networknt.schema=off 以防止在 schema 验证过程中出现过量调试日志记录。

验证

  • 您可以检查生成的服务器配置文件 target/server/standalone/configuration/standalone.xml,其中包含置备的子系统和应用程序部署。

包含部署的 JBoss EAP 服务器已被置备。

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat