Customizing A Module Location

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

  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.apache.maven.plugins</groupId>
  5. <artifactId>maven-ear-plugin</artifactId>
  6. <version>3.3.0</version>
  7. <configuration>
  8. [...]
  9. <modules>
  10. <jarModule>
  11. <groupId>artifactGroupId</groupId>
  12. <artifactId>artifactId</artifactId>
  13. <bundleDir>APP-INF/lib</bundleDir>
  14. </jarModule>
  15. </modules>
  16. </configuration>
  17. </plugin>
  18. </plugins>
  19. </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:

  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.apache.maven.plugins</groupId>
  5. <artifactId>maven-ear-plugin</artifactId>
  6. <version>3.3.0</version>
  7. <configuration>
  8. [...]
  9. <defaultLibBundleDir>APP-INF/lib</defaultLibBundleDir>
  10. <modules>
  11. <jarModule>
  12. <groupId>artifactGroupId</groupId>
  13. <artifactId>artifactId</artifactId>
  14. <bundleDir>/</bundleDir>
  15. </jarModule>
  16. </modules>
  17. </configuration>
  18. </plugin>
  19. </plugins>
  20. </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.