我们已经改变了从Eclipse到Maven构建旧项目的方式,现在我们正在尝试改进构建时间(在Eclipse中它是<10秒,在Maven中它是> 1分钟)。
我注意到EAR插件扩展然后重新调整子部署(WAR和EJB jar):
[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/
...............................
在这种情况下的问题是WAR项目有很多小图标,并且通过扩展/压缩来花费太多时间。
问题1 :为什么EAR maven插件会这样做?如果它只需要将MANIFEST.MF文件添加到WAR,为什么不简单地添加该条目to the existing ZIP file(WAR == JAR == ZIP的文件格式)? 问题2 :此问题是否有解决方法?