我有两个战争文件:core.war和service.war
存档core.war包括jboss-deployment-structure.xml:
<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclude-subsystems>
<subsystem name="logging"/>
<subsystem name="pojo"/>
</exclude-subsystems>
<exclusions>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
<module name="org.slf4j.ext"/>
<module name="org.slf4j.jcl-over-slf4j"/>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.logging.jul-to-slf4j-stub"/>
<module name="org.jboss.logmanager"/>
<module name="org.jboss.log4j.logmanager"/>
<module name="org.jboss.as.logging"/>
<!-- exclude wildfly logging modules, use slf4j + logback -->
<module name="org.jboss.logmanager.log4j"/>
</exclusions>
<dependencies>
<module name="deployment.some-dep-1.ear" meta-inf="import"/>
<module name="deployment.some-dep-2.ear" meta-inf="import" services="import" optional="true"/>
<module name="deployment.some-dep-3.ear" meta-inf="import"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
service.war包括jboss-deployment-structure.xml:
<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclude-subsystems>
<subsystem name="logging"/>
<subsystem name="pojo"/>
</exclude-subsystems>
<exclusions>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
<module name="org.slf4j.ext"/>
<module name="org.slf4j.jcl-over-slf4j"/>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.logging.jul-to-slf4j-stub"/>
<module name="org.jboss.logmanager"/>
<module name="org.jboss.log4j.logmanager"/>
<module name="org.jboss.as.logging"/>
<!-- exclude wildfly logging modules, use slf4j + logback -->
<module name="org.jboss.logmanager.log4j"/>
</exclusions>
<dependencies>
<module name="deployment.core.war" services="import" meta-inf="import"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
我有叠加层:
独立的.xml:
...
<deployment-overlays>
<deployment-overlay name="dep-lib">
<!-- ... -->
<content path="/WEB-INF/lib/org-springframework-spring-aop-3.2.10.RELEASE.jar" content="77d0b86238df32cb15e469eaa2f7f32c4893dc54"/>
<content path="/WEB-INF/lib/org-springframework-spring-aspects-3.2.10.RELEASE.jar" content="d5327b3d4a74f224d32c338e83789ae877feb790"/>
<!-- ... -->
<deployment name="core.war"/>
</deployment-overlay>
</deployment-overlays>
...
在这种情况下,service.war模块中的 classLoader 无法加载在some-dep-1.ear / some-dep-2.ear / some-dep-3.ear中声明的类,因为标签中的默认属性 export="false"<module/>
现在我想排除一些对service.war的覆盖依赖。我尝试使用<export/>
这样的标签:
<?xml version='1.0' encoding='UTF-8'?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<deployment>
<exclude-subsystems>
<subsystem name="logging"/>
<subsystem name="pojo"/>
</exclude-subsystems>
<exclusions>
<module name="org.slf4j"/>
<module name="org.slf4j.impl"/>
<module name="org.slf4j.ext"/>
<module name="org.slf4j.jcl-over-slf4j"/>
<module name="org.apache.log4j"/>
<module name="org.apache.commons.logging"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.logging.jul-to-slf4j-stub"/>
<module name="org.jboss.logmanager"/>
<module name="org.jboss.log4j.logmanager"/>
<module name="org.jboss.as.logging"/>
<!-- exclude wildfly logging modules, use slf4j + logback -->
<module name="org.jboss.logmanager.log4j"/>
</exclusions>
<exports>
<exclude-set>
<path name="**"/>
</exclude-set>
<include-set>
<path name="org/slf4j"/>
</include-set>
</exports>
<dependencies>
<module name="deployment.some-dep-1.ear" meta-inf="import"/>
<module name="deployment.some-dep-2.ear" meta-inf="import" services="import" optional="true"/>
<module name="deployment.some-dep-1.ear" meta-inf="import"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
但这不起作用。
如何排除用于导出的覆盖依赖项?