javamavenmaven-ear-plugin

Prevent the EAR maven plugin from expanding and rezipping subdeployments during packaging


We have switched the way an old project was built from the Eclipse to Maven and now we are trying to improve the build time (in Eclipse it was <10sec and in Maven it is >1min).

I have noticed that the EAR plugin expands and then re-zipps the subdeployments (WAR and EJB jars):

[2016-06-07 11:35:52] [DEBUG] Resolving ear modules ...
[2016-06-07 11:35:52] [DEBUG] Resolving ear module[war:com.my-group:MyProj_web]
[2016-06-07 11:35:52] [INFO] Copying artifact [war:com.my-group:MyProj_web:0.0.5-SNAPSHOT] to [MyProj_web.war]
[2016-06-07 11:35:52] [DEBUG] Created a temporary work directory: /home/andrew/ELuna/myproj/project/MyProj_ear/target/temp/MyProj_web
[2016-06-07 11:35:52] [DEBUG] Expanding: /home/andrew/ELuna/myproj/project/MyProj_ear/target/MyProj_ear-default-name/MyProj_web.war into /home/andrew/ELuna/myproj/project/MyProj_ear/target/temp/MyProj_web
[2016-06-07 11:36:08] [DEBUG] expand complete
[2016-06-07 11:36:08] [DEBUG] Zipping module
[2016-06-07 11:36:13] [INFO] Building zip: /home/andrew/ELuna/myproj/project/MyProj_ear/target/MyProj_ear-default-name/MyProj_web.war
[2016-06-07 11:36:13] [DEBUG] adding directory WEB-INF/
[2016-06-07 11:36:13] [DEBUG] adding directory WEB-INF/jsp/
[2016-06-07 11:36:13] [DEBUG] adding directory WEB-INF/lib/
[2016-06-07 11:36:13] [DEBUG] adding directory WEB-INF/classes/
[2016-06-07 11:36:13] [DEBUG] adding directory WEB-INF/classes/com/
[2016-06-07 11:36:13] [DEBUG] adding directory WEB-INF/classes/com/my-group/
[2016-06-07 11:36:13] [DEBUG] adding directory WEB-INF/classes/com/my-group/lib/
...............................

The problem in this case is that the WAR project has a lot of small icons and it takes too much time by expanding/zipping.

Question 1: why does the EAR maven plugin does so? If it simply needs to add the MANIFEST.MF file to the WAR, why not simply add that entry to the existing ZIP file (the file format of WAR==JAR==ZIP)? Question 2: are there any workaround for this problem?


Solution

  • The exact cause of this behavior seems to be the <skinnyWars>true</skinnyWars> setting of the plugin. So the workaround is not to use it, in which case the build time will get a bit faster.