[jboss-as7-dev] JBoss Modules: can I dynamically add dependency?

ssilvert at redhat.com ssilvert at redhat.com
Mon Sep 24 08:06:12 EDT 2012


I have a module defined like this (currently in master with main and
slot="1.2):
<module xmlns="urn:jboss:module:1.1" name="org.jboss.as.jsf-injection">   
    <resources>
        <resource-root
path="jboss-as-jsf-injection-7.2.0.Alpha1-SNAPSHOT.jar"/>
    </resources>

    <dependencies>
        <module name="com.sun.jsf-impl"/>   <----- this needs to be dynamic
        <module name="javax.api"/>
        <module name="org.jboss.as.web"/>
        <module name="javax.servlet.api"/>
    </dependencies>
</module>

Inside a DeploymentUnitProcessor, the module above is added to the
ModuleSpecification along with the module for the selected JSF
implementation.  The problem I have is that the JSF Injection code is
the same for any Mojarra implementation.  But to support multiple
implementations I need to declare a separate jsf-injection module with a
hard-coded dependency on each implementation installed.

If I could create a module dynamically and dynamically add its
dependencies then there would be no need to create more and more modules
containing the same jsf-injection jar.

I've been looking at the JBoss Modules API and I don't see how to do
this.  Is it possible?

Stan


More information about the jboss-as7-dev mailing list