Maven Explosion Plugin

This Maven 1.x plugin (work in progress for Maven 2.x) allows to process an artifact (and its contained artifacts) into an exploded directory structure.

The idea of this plugin is to let Maven normally build the artifacts (JARs, WARs and the EAR file) and then 'post processes' the main artifact (EAR, WAR or JAR) and explodes it. The process may be recursive, allowing to explode any other artifact contained in a previously exploded one.

For more information on the functionality provided by this plugin, please see the Goals document.

For more information on how to customise the functionality provided by this plugin, please see the Properties document.

Use case : an example

They are probably plenty of good reasons why you would want to have an exploded directory structure for your artifact. But initially, this plugin was developped to perform hot deployment with the different developments projects that built the artifacts.

Let's assume the following project organization :

  • Utility project that contains the business logic. Maven builds a domain.jar
  • Web project, with domain.jar in WEB-INF/lib. Maven builds a web.war
  • EAR project containing the web.war. Maven builds a project.ear

Following example, relies heavily on properties default values. For an exhaustive list of properties, see the Properties document.

In project.properties of EAR project :


01: maven.explosion.archive.type=ear
02: 
03: maven.explosion.archive.embedded.0=true
04: maven.explosion.archive.embedded.0.name=web.war
05:		
06: maven.explosion.archive.embedded.1=true
07: maven.explosion.archive.embedded.1.name=domain.jar
08: maven.explosion.archive.embedded.1.dir=web.war/WEB-INF/lib
09: maven.explosion.archive.embedded.1.todelete=true
10: maven.explosion.archive.embedded.1.exploded.name=classes
11: maven.explosion.archive.embedded.1.exploded.dir=web.war/WEB-INF/
	    
	    

Line 01 : the main archive to explode is the ear file.

Line 03-04 : the embedded archive web.war must be exploded.

Line 06-11 : the domain.jar located in WEB-INF/lib of the exploded war file (in this case web.war is the name of the exploded directory) must be exploded in WEB-INF/classes. After explosion, the orginal war file is deleted.