Customizing A Module Location

The example below shows how to place a library in the APP-INF/lib directory of the EAR file:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.4.2</version>
        <configuration>
           [...]
           <modules>
             <jarModule>
               <groupId>artifactGroupId</groupId>
               <artifactId>artifactId</artifactId>
               <bundleDir>APP-INF/lib</bundleDir>
             </jarModule>
          </modules>
        </configuration>
      </plugin>
    </plugins>
  </build>

Note that it is possible to specify a default bundle directory for all libraries. If a Jar module has not the bundleDir property above, the default one is used. Below is an example of such configuration:

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.4.2</version>
        <configuration>
           [...]
           <defaultLibBundleDir>APP-INF/lib</defaultLibBundleDir>
           <modules>
             <jarModule>
               <groupId>artifactGroupId</groupId>
               <artifactId>artifactId</artifactId>
               <bundleDir>/</bundleDir>
             </jarModule>
          </modules>
        </configuration>
      </plugin>
    </plugins>
  </build>

In the above case, jar modules (i.e. libraries) will be placed in the APP-INF/lib directory except the specified artifact which will be placed at the root of the EAR structure.