Introduction

The EJB plugin allows to package an EJB module. It provides also the following customization:

  • Generation of ejb-client
  • The ejb version to use
  • Client inclusion and exclusion parameters

Generating the client

To generate the ejb-client jar as well, you need to set the generateClient to true in the plugin's configuration:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ejb-plugin</artifactId>
        <configuration>
           <generateClient>true</generateClient>
        </configuration>
      </plugin>
    </plugins>
  </build>

Specifying the ejb version to use

In EJB3, the ejb-jar.xml deployment descriptor is not mandatory anymore. By default the plugin uses the version 2.1. To use another version, configure the plugin as follows:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ejb-plugin</artifactId>
        <configuration>
           <ejbVersion>3.0</ejbVersion>
        </configuration>
      </plugin>
    </plugins>
  </build>

Client inclusions and exclusions

The content of the ejb-client archive can be customized using inclusions and exclusions. By default **/*Bean.class, **/*CMP.class, **/*Session.class and **/package.html are excluded. To customize this, use clientExcludes and clientIncludes element:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ejb-plugin</artifactId>
        <configuration>
           <clientIncludes>
             <clientInclude>com/foo/bar/**</clientInclude>
             <clientInclude>com/foo/acme/**</clientInclude>
           </clientIncludes>
        </configuration>
      </plugin>
    </plugins>
  </build>