Exploded war files gives the webapp project rapid testing capability, war files can be deployed in the web container in exploded form.
War file generation of large webapp projects normally take time, using the exploded goal can speed up the processing of the war by only updating the modified files or resources on the exploded war.
package
To explicitly execute the goal
m2 war:exploded
or with the added configuration line on your pom.xml
<project> ... <build> <plugins> <plugin> <groupId>org.apache.maven</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1</version> <goals> <goal>exploded</goal> </goals> </plugin> <plugins> ... ... </build> ... </project>
specifying the package phase would achieve the same result
mvn package
Given the project structure
/project_root /project_root/pom.xml /project_root/src/main/java/package/source /project_root/src/main/resource/someresource /project_root/src/main/webapp/WEB-INF/jsp/anotherwebsource /project_root/src/main/webapp/WEB-INF/somewebsource /project_root/src/main/webapp/websources
with pom.xml
<project> <modelVersion>4.0.0</modelVersion> <groupId>com.somecompany.webapp<gropuId> <artifactId>webapp-service</artifactId> <version>0.0</version> <packaging>war</packaging> <name>Some Company Webapp Service</name> <dependencies> <dependency> <groupId>com.closed.package</groupId> <artifactId>runtimedependency</artifactId> <version>0.0</version> <scope>runtime<scope> </dependency> <dependency> <groupId>com.closed.package</groupId> <artifactId>normaldependency</artifactId> <version>0.0</version> <!-- if no scope is defined, it defaults to compile --> </dependency> </dependencies> </project>
executing the command
mvn war:exploded
would assemble the exploded webapp on "target/webapp-service"
target/webapp-service/META-INF/MANIFEST.MF target/webapp-service/META-INF/maven/org.apache.maven.repository/maven-repository-webapp/pom.xml target/webapp-service/META-INF/maven/org.apache.maven.repository/maven-repository-webapp/pom.properties target/webapp-service/WEB-INF/lib/runtimedependency-0.0.jar target/webapp-service/WEB-INF/classes/<generated classes from "src/main/java"> target/webapp-service/WEB-INF/jsp/anotherwebsource target/webapp-service/WEB-INF/somewebsource target/webapp-service/websources
You might wonder why the other dependency is not included in WEB-INF/lib, only dependencies with a runtime scope are included in the war file.