Writing a Custom WildFly Module: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 63: Line 63:
</pre>
</pre>


==Make its Dependents Aware==
==Make the Module Dependents Aware==


In case of a web application, place a <tt>jboss-deployment-structure.xml</tt> similar to the example shown below under <tt>WEB-INF</tt>:
In case of a web application, place a <tt>jboss-deployment-structure.xml</tt> similar to the example shown below under <tt>WEB-INF</tt>:

Revision as of 08:34, 19 January 2016

External

Internal

Example


https://github.com/NovaOrdis/playground/tree/master/wildfly/custom-module

Naming Conventions

Module Name

The module name is a dot-separated, fully qualified, unique, package name-like string. Conventionally, the name of the module coincides with the embedded top package, though nothing bad seems to happen it does not. Example: com.novaordis.playground.wildfly.custommodule.

Module JAR Name

Conventionally, it should be the condensed form of the module name, including the version string. Example custom-wildfly-module-1.0.jar.

Module Location

$JBOSS_HOME/modules/com/novaordis/playground/wildfly/custommodule/<version>|main/

Process

Write Code and Package It According the Naming Conventions

See Naming Conventions above.

Copy the JAR under WildFly's module Directory

See Module Location above.

Create a module.xml in the Same Module Directory

The content of the module.xml should be similar to:

<?xml version="1.0" encoding="UTF-8"?>

<module xmlns="urn:jboss:module:1.1" name="com.novaordis.playground.wildfly.custommodule" slot="1.0">

    <!--
    <main-class name="com.novaordis.playground.wildfly.custommodule.SharedFunctionality"/>
    -->

    <properties>
        <property name="some.property.name" value="some.property.value"/>
    </properties>

    <resources>
        <resource-root path="custom-wildfly-module-1.0.jar"/>
    </resources>

</module>

Make the Module Dependents Aware

In case of a web application, place a jboss-deployment-structure.xml similar to the example shown below under WEB-INF:

<?xml version="1.0" encoding="UTF-8"?>

<jboss-deployment-structure>
  <deployment>
    <dependencies>
      <module name="com.novaordis.playground.wildfly.custommodule" slot="1.0"/>
    </dependencies>
  </deployment>
</jboss-deployment-structure>