# Inteligr8 Wildfly Module Plugin This Maven plugin is designed to manage both Wildfly module projects and Wildfly deployment project integration with Wildfly modules. ## Objective A module is a set of libraries and directories that can be deployed to the Wildfly `modules` directory. A Wildfly module can be inherited by other modules and deployments. It provides the *shared library* idea implemented by most application servers. Wildfly ships with several modules already installed. These are called system modules. When creating a deployment, you can have it depend on these shared modules by declaring the module in your deployment descriptor. This means you should not include those libraries in your deployment. However, you still need those libraries for compile-time purposes. Those libraries should be treated as `provided` dependencies. Likewise, the same nuance applies to the development of custom modules. This Maven plugin aims to resolve these packaging headaches. ## Use ### Wildfly System Module Wildfly ships with several modules. It has a Maven BOM for all library version management, but not any segmentation of libraries by module. So in tandem with this plugin, another project was created for declaring [Wildfly system modules: wildfly-system-modules](https://bitbucket.org/inteligr8/wildfly-system-modules). This allows a developer to reference a Wildfly system module as a `provided` dependency to their project. These modules do not use this plugin. They are just an integral part of other modules and deployments. ### Wildfly User Module You can develop your own modules, use them privately, share them publicly in Maven, and/or use modules shared by others through Maven. The process is the same as using Wildfly system modules. You can do this by including this plugin in your POM. There are 3 goals for modules: | Goal | Default Phase | Purpose | | ---- | ------------- | ------- | | `module-generate` | `generate-resources` | Generates the `module.xml` file in the appropriate module directory. The file will enumerate all dependencies, either as resources or modules. | | `module-resources` | `prepare-package` | Copies the non-module dependencies to the appropriate module directory. | | `module-package` | `package` | ZIPs the module so it can be unzipped in the Wildfly `modules` directory. | All module projects must/may have the following properties: | Property | Required | Notes | | -------- | -------- | ----- | | `wildfly.module.id` | Yes | This determines the path of the module when installed and how it is referenced by other Wildfly component descriptors. It is transparent to other Maven projects during development. | | `wildfly.module.system` | No | `true` or `false`; default `false`; This module is a Wildfly-provided system module. | | `wildfly.module.meta` | No | `true` or `false`; default `false`; This module provides META-INF resources. | | `wildfly.module.services` | No | `true` or `false`; default `false`; This module provides META-INF/services resources. | | `wildfly.module.annotations` | No | `true` or `false`; default `false`; This module provides annotation actionable resources. | | `wildfly.module.outputDirectory` | No | Default: `target/wildfly-module` | You will want to define the plugin as follows. ```xml com.inteligr8.wildfly wildfly-module-plugin module module-generate module-resources module-package ``` You could use Git to clone the module project down to the Wildfly server and use `wildfly.module.outputDirectory` to install modules directory into the Wildfly `modules` directory. ### Wildfly Web Application Deployment There is only one goal for this scenario: | Goal | Default Phase | Purpose | | ---- | ------------- | ------- | | `war` | `package` | Generates the `jboss-deployment-structure.xml` file, copies the non-module dependencies, and creates the WAR package. This is a replacement for `maven-war-plugin`. | All deployment projects may have the following properties: | Property | Required | Notes | | -------- | -------- | ----- | | `wildfly.deployment.outputDirectory` | No | Default: `target/${artifactId}-${version}` | | `wildfly.webapp.directory` | No | Default: `src/main/webapp` | You can also use the plugin configuration to define standard `resources`. You will find an example below. ```xml com.inteligr8.wildfly wildfly-module-plugin src/wildfly/webapp deployment war maven-war-plugin 3.3.2 true ``` > `maven.war.skip` does not work in the default `maven-war-plugin` version. ### Wildfly Enterprise Application Deployment This is stubbed out in the source, but not yet supported.