1 Reply Latest reply on Apr 7, 2015 12:55 AM by dibu

    Dependency on a deployed CDI module

    dibu

      I want to deploy two modules to wildfly 8.2. The module-a contains beans (and later CDI producer and other stuff) and module-b use this beans. Beans from module-a should be injected with CDI in module-b (There is a beans.xml in both modules.). All works fine if the module-a is direct referenced as dependency like this:

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

        <deployment>

        <dependencies>

        <module name="deployment.module-a-1.0.0.jar" meta-inf="import" />

        </dependencies>

        </deployment>

      </jboss-deployment-structure>

       

      But the dependency to module-a should be without to know the deployed version, so I tried to set a module alias and (or) to re-export module-a under a different name like this.

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

        <deployment>

        <module-alias name="deployment.module-a-alias" />

        </deployment>

      </jboss-deployment-structure>

       

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

        <module name="deployment.module-a">

        <module-alias name="deployment.module-a-alias" />

        <dependencies>

        <module name="deployment.module-a-1.0.0.jar" export="true" meta-inf="export" />

        </dependencies>

        </module>

      </jboss-deployment-structure>

       

      But either the module alias or a re-export under a new module name worked. The reported exception is always:

      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type XYZ with qualifiers @Default

       

      The module alias fit my requirements and I guess is should work with CDI but it dosn't.

      Two questions:

      - Why CDI don't work with module alias and module re-export?

      - How to deal with dependencies and module versions?