I have multiple .ear projects which use multiple libraries. So I need to make those as common and add those in the module. So Is there any easy way to create module.xml as I nee
No need to create 'module.xml' for each library.
Create a single module and put all libraries there and mention it in resource-root. Also mention any module dependencies (if no, ignore it).
Example module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.test.myownresteasy">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<resource-root path="activation-1.1.jar"/>
<resource-root path="httpcore-4.1.2.jar"/>
<resource-root path="jettison-1.3.1.jar"/>
<resource-root path="resteasy-jaxrs-2.3.2.Final.jar"/>
<resource-root path="scannotation-1.0.3.jar"/>
<resource-root path="httpclient-4.1.2.jar"/>
<resource-root path="jaxrs-api-2.3.2.Final.jar"/>
<resource-root path="jul-to-slf4j-stub-1.0.0.Final.jar"/>
<resource-root path="resteasy-jaxb-provider-2.3.2.Final.jar"/>
<resource-root path="resteasy-jettison-provider-2.3.2.Final.jar"/>
</resources>
<dependencies>
<!-- Insert dependencies here -->
</dependencies>
</module>
Copy your modules to '$JBOSS/modules' directory which makes it as global module.
Refer: How can I use the external jars on JBoss 7?