I need to generate module.xml file for JBoss7 for a maven project which has a lot of jar-dependencies. What is the easiest way to do it? The file looks like:
<module xmlns="urn:jboss:module:1.0" name="ats.platform">
<resources>
<resource-root path="dom4j-1.6.1.jar"/>
<resource-root path="jdom-1.0.jar"/>
...
</resources>
</module>
so that the <resource-root> element should be created for each project jar-dependency.
Or maybe I doing something wrong? What’s correct way to create a JBoss7 module from a maven project?
I don’t really know about JBoss and whether there’s another way to do this, but you can do it quite simply with GMaven:
A couple of things to note:
runtimeClasspathElementscontain absolute paths to the jar, which is why I parse it with a regex. You can adjust the regex to include more of the path or just prepend a string if you need more than just the jar file name.I’ve posted a working example on github (it’s just a POM) where I’ve bound the above plugin configuration to the initialize build phase. If you have git, you can clone and run it yourself with:
In the sample project, I added jdom 1.0 and dom4j 1.6.1 as dependencies, and here’s the output it created:
Note: I’m not a groovy expert, so there may be a groovier way to do it, but you can see how easy it is even so.