[wildfly-dev] add a module dependency in a DeploymentUnitProcessor
Carl Harris
ceharris414 at me.com
Tue Feb 17 10:34:57 EST 2015
I’ve written an extension in which I would like to make add a module dependency to a deployment (as if the dependency had been included in the Dependencies manifest header or jboss-deployment-structure.xml).
I’m assuming that this needs to happen in a DeploymentUnitProcessor. Looking at how the ManifestDeploymentProcessor in wildfly-core works, it seems I should be able to do something like this in a deployment processor that runs in the PARSE phase:
ModuleIdentifier moduleId = ModuleIdentifier.create(“org.example.api”);
ModuleLoader loader = Module.getBootModuleLoader();
ModuleDependency dependency = new ModuleDependency(loader, moduleId, false, false, false, false);
phaseContext.addToAttachmentList(Attachments.MANIFEST_DEPENDENCIES, dependency);
This isn’t working — the deployment unit processor runs without error, but when I try to reference classes provided by the module, I get NoClassDefFoundError.
Of course, If I add the same module identifier to the Dependencies manifest header in the deployment itself, all is well.
Perhaps this isn’t the way to approach this problem?
Thanks in advance for any tips/guidance,
carl
More information about the wildfly-dev
mailing list