Skip navigation
2012

Module.xml is a file defining how JBoss Modules, part of the AS 7 core, will treat the content of the module.

 

JBoss Modules is mostly about classloading, so almost whole content of module.xml is for classloaders.

Here is the official info:

However the first is not complete, the comments in XSD are a bit uninformative, and the last is about classloading in general, so I 'll put a brief summary here.

 

Full module.xml example with comments

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

<module xmlns="urn:jboss:module:1.1" name="org.jboss.msc">

    <!-- Main class to use when launched as a standalone jar. -->
    <main-class name="org.jboss.msc.Version"/>

    <!-- Properties readable through Modules API. Not to be confused with Java system properties. -->
    <properties>
        <!-- jboss.api=private means that the module is not part of the JBoss AS 7 public API - basically saying, "Don't use it's packages in your apps." -->
        <property name="jboss.api" value="private"/>
    </properties>

    <resources>
        <!-- Basically, list of jars to load classes and resources from. -->
        <resource-root path="jboss-msc-1.0.1.GA.jar"/>
        ...
    </resources>

    <dependencies>

        <!--  Export paths and packages from the class loader which loaded JBoss Modules (usually the system's application CL). -->
        <system export="true">
            <!-- List of exported paths. Mandatory. -->
            <paths>
               <path name="org/jboss/modules"/>
               <path name="org/jboss/modules/log"/>
            </paths>
            <!-- Optional limitation of what's exported. -->
            <exports>
                 <include path="META-INF/"/>
            </exports>
        </system>

        <!-- Dependencies on other modules. Classloader of this module will have their classes visible. -->
        <module name="javax.api"/>
        <module name="org.jboss.logging"/>

        <!-- services="import/export/none" controls whether services defined in META-INF/services are also visible to/from this module.
               I.e. services="export" will make the services of this module visible to the dependency. Import will do the other way around.
               Defaults to "none". -->
        <!-- export="true" controls whether own exports of this dependency are visible. -->
        <module name="org.jboss.ws.native.jbossws-native-core" services="export" export="true">
            <!-- You can limit what packages in dependency modules are allowed 
                   to be seen from this module's point of view (import), or vice versa (export).
                   By default, all are imported/exported. When you specify <imports> or <exports>, only those listed are. -->
            <imports>
               <include path="META-INF"/>
               <include path="dtd"/>
               <include path="schema"/>
               <exclude-set>
                   <path name="org.jboss.example.tests"/>
               </exclude-set>
            </imports>
            <exports>
                <include path="META-INF"/>
                <include path="dtd"/>
                <include path="schema"/>
            </exports>
        </module>

        <!-- Optional deps -->
        <module name="javax.inject.api" optional="true"/>
    </dependencies>
</module>

Filter Blog

By date:
By tag: