<div dir="ltr"><div>Hi,<br><br>you should change code a bit, to something like this<br><br><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Courier New";font-size:12pt"><span style="color:rgb(0,0,128);font-weight:bold">final </span>ModuleSpecification moduleSpec = phaseContext.getDeploymentUnit().getAttachment(Attachments.<span style="color:rgb(102,14,122);font-weight:bold;font-style:italic">MODULE_SPECIFICATION</span>);<br>moduleSpec.addSystemDependency(dependency);<br></pre>and you should run your DUP in Phase.<span style="color:rgb(102,14,122);font-weight:bold;font-style:italic">DEPENDENCIES</span></div><div><br>--<br></div>tomaz<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 17, 2015 at 4:34 PM, Carl Harris <span dir="ltr"><<a href="mailto:ceharris414@me.com" target="_blank">ceharris414@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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).<br>
<br>
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:<br>
<br>
ModuleIdentifier moduleId = ModuleIdentifier.create(“org.example.api”);<br>
ModuleLoader loader = Module.getBootModuleLoader();<br>
ModuleDependency dependency = new ModuleDependency(loader, moduleId, false, false, false, false);<br>
phaseContext.addToAttachmentList(Attachments.MANIFEST_DEPENDENCIES, dependency);<br>
<br>
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.<br>
<br>
Of course, If I add the same module identifier to the Dependencies manifest header in the deployment itself, all is well.<br>
<br>
Perhaps this isn’t the way to approach this problem?<br>
<br>
Thanks in advance for any tips/guidance,<br>
<br>
carl<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a></blockquote></div><br></div>