问题描述
maven插件对我来说非常慢.在我的项目中,webapp文件夹中有将近15000个小文件(图像,jsp,css等).当我用Maven组装它时,它首先将所有文件复制到target/myProject-1.0.0
目录,然后从中构建myProject-1.0.0.war
文件.复制过程需要10分钟,而构建.war
则需要2分钟.
The maven plugin works very slow for me. In my project the webapp folder has nearly 15000 small files (images, jsp, css, etc). When I assemble it with the maven, it first copies all files to the target/myProject-1.0.0
directory, then builds myProject-1.0.0.war
file from it. The copy process takes 10 minutes, building the .war
takes 2 minutes.
如我所见,如果直接从webapp文件夹中组装.war
文件,则构建速度可能会更快.有可能吗?
As I see the build could be much faster if the .war
file will be assembled straight from the webapp folder. Is it possible to do?
推荐答案
我建议您使用war:inplace目标-plugin/inplace-mojo.html"rel =" nofollow> maven-war-plugin
以及自定义 maven-antrun-plugin
任务.
I suggest that you use the use the war:inplace
goal of maven-war-plugin
together with a custom maven-antrun-plugin
task.
war:inplace
将在WAR源目录中生成webapp.它将在webapp
下创建所有必要的额外文件夹.
The war:inplace
will generate the webapp in the WAR source directory. It will create all necessary extra folders under webapp
.
antrun:run
可以根据您的特殊要求进行定制以创建战争.
The antrun:run
can be customized to create the war according to your special requirements.
这将潜在地提高性能,因为您拥有的大多数资源文件仍将位于webapp
文件夹中且不会被复制.
This will potentially improve the performance since most of those resource files you have will still be in the webapp
folder and not being copied.
这篇关于加速Maven War插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!