【问题标题】:Wildfly 14 How java classes from one EAR file could be accessed by another EARWildfly 14 一个 EAR 文件中的 java 类如何被另一个 EAR 访问
【发布时间】:2019-11-26 10:42:54
【问题描述】:

我有两个 .Ear 文件,分别是 ABC.EAR 和 XYZ.EAR。

ABC.ear 对 XYZ.ear 中的一些 jar 有一些依赖关系。

  1. 我无法将它们打包到一个 .EAR 文件中。
  2. 我无法将使用的库放在 WildFly 的 lib 文件夹中(WildFly\modules\system\layers\base)。

【问题讨论】:

  • 是否有任何紧迫的原因导致您无法采用您排除的策略,或者只是偏好?
  • 无论如何,我可能误解了情况,但是您尝试过global modules吗?
  • 为什么不将库放入他们需要的每个耳朵?

标签: wildfly wildfly-14


【解决方案1】:

在 XYZ.ear 中的罐子。

如果jar是子部署,可以在依赖ear的jboss-deployment-structure.xml中指定依赖。

例如ABC.ear/META-INF/jboss-deployment-structure.xml:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="deployment.XYZ.ear.xxxx1.jar">   <!-- xxxx1.jar is a sub-deployement of XYZ.ear -->
                <imports>
                    <include path="**"/>
                </imports>
            </module>
            <module name="deployment.XYZ.ear.xxxx2.jar">   <!-- xxxx2.jar is a sub-deployement of XYZ.ear -->
                <imports>
                    <include path="**"/>
                </imports>
            </module>

            <!-- other dependencies here ... -->
        </dependencies>
    </deployment>
</jboss-deployment-structure>

您可以在 WF 管理控制台中查看 ear 的子部署列表:部署菜单 -> 选择 ear -> 子部署。

如果 jar 只是库(不是子部署),那么您应该能够将相同的库添加到 ABC.ear。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-14
    • 2015-12-04
    • 2023-03-22
    • 1970-01-01
    • 2013-06-01
    相关资源
    最近更新 更多