Skip to end of metadata
Go to start of metadata

Introduction

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.

Dependencies 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:

Dependencies: org.some.module, org.another.module

You can also specify a version slot by appending the version slot after the module name like this:

Dependencies: org.some.module:main, org.another.module:1.0

Each entry follows this format:

<module-name> [optional] [export]

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.

Adding the Dependencies header using Maven

Below is an example of how the Depencencies header can be added to a projects Maven pom.xml:

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.