Module Section

Shows the structure of the module element within the plugin configuration. This information allows to construct a module.xml as specified by Module descriptors.

The module element matches with the includes and excludes sections a Maven dependency defined in the POM. Once matched, the rules defined in the module (e.g. should it be skipped or exported) are applied.

It is important to note that the sequence of module elements is significant. The matcher applies the modules in the order given. Therefore you have to specify the most restrictive modules first (this is like the order of the exceptions in the catch blocks in Java, the most specific come first):

For information on importing module descriptors, please refer to Import Module Descriptors.

Outline

This is the complete outline of a modules element to be specified within the plugin configuration (please refer to Usage for details):

<module>
    <name></name>
    <slot></slot>
    <skip></skip>
    <includes>
      <include>
        <groupId></groupId>
        <artifactId></artifactId>
      </include>
      ...
      <include>
        <groupId></groupId>
        <artifactId></artifactId>
      </include>
    </includes>
    <excludes>
      <exclude>
        <groupId></groupId>
        <artifactId></artifactId>
      </exclude>
      ...
      <exclude>
        <groupId></groupId>
        <artifactId></artifactId>
      </exclude>
    </excludes>
    <properties>
      <one>two</one>
      <three>four</three>
      ...
    </properties>
    <dependencies>
      <dependency>
        <name></name>
        <slot></slot>
        <export></export>
        <services></services>
        <optional></optional>
      </dependency>
      ...
    </dependencies>

    <export>
      <includes>
        <include></include>
        ...
        <include></include>
      </includes>

      <excludes>
        <exclude></exclude>
        ...
        <exclude></exclude>
      </excludes>
    </export>

    <services>
      <port>
        <value></value>
        <includes>
          <include></include>
          ...
          <include></include>
        </includes>

        <excludes>
          <exclude></exclude>
          ...
          <exclude></exclude>
        </excludes>
      </port>
      ...
      <port>
        <value></value>
        <includes>
          <include></include>
          ...
          <include></include>
        </includes>

        <excludes>
          <exclude></exclude>
          ...
          <exclude></exclude>
        </excludes>
      </port>
    </services>
  </module>

Module Elements

This is a short specification of the elements within the module element.

Basic Information

<module>
    <name></name>
    <slot></slot>
    <skip></skip>
    ...
  </module>

The name of the module. Is used for the name attribute in the module.xml base element.

The slot to write to. If empty, the default slot is provided in the defaultSlot configuration of the Mojo.

The path to store the module.xml and all its resources. If not given, the path defaults to the groupId and artifactId in case the groupId does not end with the artifactId. If it does, it defaults to the groupId alone.

The flag skip allows to skip the export of the module. With this flag you may rename a dependency to an existing module in JBoss, but not to create a module as a folder.

Matching a Dependency

As mentioned above, a module is matching a dependency declared by the POM with includes an excludes.

<module>
    ...
    <includes>
      <include>
        <groupId></groupId>
        <artifactId></artifactId>
      </include>
      ...
      <include>
        <groupId></groupId>
        <artifactId></artifactId>
      </include>
    </includes>
    <excludes>
      <exclude>
        <groupId></groupId>
        <artifactId></artifactId>
      </exclude>
      ...
      <exclude>
        <groupId></groupId>
        <artifactId></artifactId>
      </exclude>
    </excludes>
    ...
  </module>

You may specify either the groupId or the artifactId or both to do the match. Each entry is matched as a regular expression.

You may also reference a group in your regular expression to be used within the name element.

<module>
  <name>org.apache.commons.$1</name>
  <includes>
    <include>
      <artifactId>commons-(.*)</artifactId>
    </include>
  </includes>
</module>

This example shows that the first group is to be used in the name. Therfore an artifact commons-lang will be given the name org.apache.commons.lang. The regular expression given is passed to Java's regular expression API.

If you use the regular expression in the groupId, add a g to the reference in the name (e.g. my.$g1.$1: this includes the first group in the groupId and the first group of the artifactId).

Properties

A module element allows to specify properties. The information given here is simply copied to the module descriptor.

<module>
    <properties>
      <one>two</one>
      <three>four</three>
      ...
    </properties>
    ...
  </module>

The name of the property is the name of the element, the value is the content of the element.

Static Dependencies

Dependencies are derived from the Maven dependencies defined in the POM. In case you need to add additional dependencies (like javax.api), this section allows you to name those to be added additionally.

<module>
    ...
    <dependencies>
      <dependency>
        <name></name>
        <slot></slot>
        <export></export>
        <services></services>
        <optional></optional>
      </dependency>
      ...
    </dependencies>
    ...
  </module>

The elements map to the elements of the module.xml:

Attribute Type Required? Description
name string Yes The name of the module upon which this module depends.
slot string No The version slot of the module upon which this module depends; defaults to "main".
export boolean No Specify whether this dependency is re-exported by default; if not specified, defaults to "false".
services enum No Specify whether this dependency's services* are imported and/or exported. Possible values are "none", "import", or "export"; defaults to "none".
optional boolean No Specify whether this dependency is optional; defaults to "false".

Source Module dependencies.

Exports

To export a module, the module's name can be matched with the includes and excludes elements. Please note that you specify the name of modules here (not the group and artifact identifiers as with matching a module). Again you are allowed to use regular expressions for matching.

<module>
    ...
    <export>
      <includes>
        <include></include>
        ...
        <include></include>
      </include>
      </includes>

      <excludes>
        <exclude></exclude>
        ...
        <exclude></exclude>
      </excludes>
    </export>
    ...
  </module>

Services

The dependency allows to add a services attribute with the values none, import, or export. For each value add a port element and use the value element to specify this value.

<module>
    ...
    <services>
      <port>
        <value></value>
        <includes>
          <include></include>
          ...
          <include></include>
        </includes>

        <excludes>
          <exclude></exclude>
          ...
          <exclude></exclude>
        </excludes>
      </port>
      ...
      <port>
        <value></value>
        <includes>
          <include></include>
          ...
          <include></include>
        </include>
        </includes>

        <excludes>
          <exclude></exclude>
          ...
          <exclude></exclude>
        </excludes>
      </port>
    </services>
  </module>

Not yet covered

A couple of elements is not yet covered by the configuration. These are

  1. module alias
  2. imports/exports with exclude-set
  3. resource filters
  4. resource path
  5. dependencies system element

Support for these element may be provided in future versions of this plugin.