The previous chapter discussed how module descriptors are structured and the options available when defining modules. This chapter will talk about how applications packaged as jars can declare that they depend on one or more modules.
For example, lets say you have an application packaged in a jar file and want to run this code using JBoss Modules. In such cases we need to have a way to of telling JBoss Modules what modules our applications depends on so that the classes and resources in those modules are available to the application. The way this is done is by using a manifest header.
The Dependencies manifest header is used to specify dependencies that a jar file has. The value is a comma-separated list, like this example:
You can also specify a version slot by appending the version slot after the module name like this:
Each entry follows this format:
The "optional" flag indicates that this dependency is optional (if it is not present, no error is thrown). The "export" flag indicates that this dependency's packages should be re-exported to consumers of the current module.
Note that some implementations (such as JBoss AS) support more flags or arguments than this on each dependency. As such, arguments which are not recognized are automatically ignored.
Below is an example of how the Depencencies header can be added to a projects Maven pom.xml: