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>3.3.0</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 jarModule does not have 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>3.3.0</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, jarModules (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.