1, Create a module directory structure:
mkdir -p $JBOSS_HOME/modules/com/mycompany/myproject/main
2, Copy common jar files to the above directory:
cp my-util.jar my-service.jar $JBOSS_HOME/modules/com/mycompany/myproject/main
3, Create a module.xml file in the new module's main directory:
<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="com.mycompany.myproject"> <dependencies> <module name="javaee.api"/> </dependencies> <resources> <resource-root path="my-util.jar"/> <resource-root path="my-services.jar"/> </resources> </module>
4, Declare the module com.mycompany.myproject as a global module, by editing
$JBOSS_HOME/standalone/configuration/standalone.xml
. Add to the ee subsystem:<subsystem xmlns="urn:jboss:domain:ee:1.1"> <global-modules> <module name="com.mycompany.myproject" slot="main"/> </global-modules> </subsystem>
Editing server configuration files is not a good idea, but so far this is the only way of adding global modules.
Add a comment