Hi,
you should change code a bit, to something like this
final ModuleSpecification moduleSpec =
phaseContext.getDeploymentUnit().getAttachment(Attachments.MODULE_SPECIFICATION);
moduleSpec.addSystemDependency(dependency);
and you should run your DUP in Phase.DEPENDENCIES
--
tomaz
On Tue, Feb 17, 2015 at 4:34 PM, Carl Harris <ceharris414(a)me.com> wrote:
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
_______________________________________________
wildfly-dev mailing list
wildfly-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/wildfly-dev