Adding modules to wildfly

Adding module com.stackoverflow

  • Pack your com.stackoverflow.${whatever} clases on a jar called stackoverflow.jar

  • Create folder com/stackoverflow/main on ${WILDFLY_HOME}/modules

  • Put the jar on the last dir

  • Create a file called module.xml with the following content:

And now you have you module available to applications

Adding module com.stackoverflow with versioning

For some reason you develop a new version of com.stackoverflow (say version 1.1), then you should:

  • Create folder com/stackoverflow/1.1 on ${WILDFLY_HOME}/modules

  • Put the new jar on last dir

  • Create file module.xml on last dir with the following content

Note the slot="1.1" modification on this example

Multiple modules directories

By default modules are placed on ${WILDFLY}/modules directory but you can have more directories with modules, just edit your standalone.conf (or standalone.conf.bat if you are on Microsoft Windows) and properly set the variable JBOSS_MODULEPATH

For example in Unix/Linux/MacOSX:


Or in Windows:

set  "JBOSS_MODULEPATH=%JBOSS_HOME%\modules;%JBOSS_HOME%\myownmodules1;%JBOSS_HOME%\myownmodules2"