我可以让 maven-assemble-plugin 运行得更快吗?
我有一个 Maven 多模块项目。最终目标包含了我们构建在 tarball 和 RPM 中以供分发的所有库等。这个目标使用了 maven-assemble-plugin,并且需要永远——通常是我们总构建时间的四分之一到一半。
我认为我们已经告诉 Maven 运行多线程(尽管我并不肯定,也不知道如何检查)。我可以做任何其他优化来使拆包/重新打包更快吗?难道只是使用更强大的机器的问题吗?我们的项目看起来没有那么大(最终结果约为 70-80 MB),但仅一个阶段就需要一分钟多的时间。
I have a maven multi-module project. The final goal wraps up all the libraries, etc., that we build in a tarball and RPM for distribution. This goal uses the maven-assembly-plugin, and it takes forever -- usually a quarter to a half of our total build time.
I think we're already telling Maven to run multithreaded (though I'm not positive, and don't know how to check). Is there any other optimization I can do to make unpacking / repacking go faster? Is it just a matter of using a beefier machine? Our project doesn't seem that big (end result is ~70-80 MB) but it takes well over a minute just for that one phase.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试通过指定 MAVEN_OPTS=-Xmx[某个较大的值] 来增加内存。我设法显着加快它的速度,但它仍然比 tar 慢。如果我有时间,我会获取来源并对其进行分析。
Try increasing memory by specifying MAVEN_OPTS=-Xmx[some large value]. I managed to speed it up significantly, but it is still slower than tar. If I have time I will get the sources and profile it.
对于具有巨大依赖层次结构的多模块、多级项目,当 Maven Reactor 非常庞大时,我就见过这种情况发生。如果这是您的情况,您可能会考虑将您的 Maven 项目拆分为较小的项目,或者建议/请求改进 Maven 程序集插件。
I've seen this happen when the maven reactor is huge, for a multi-module, multilevel project with enormous dependency hierarchy. If this is the your case, you might consider splitting your maven project to smaller ones, or suggest/ask for improvement for the maven assembly-plugin.
升级到最新版本的 Maven Assembly 插件。新版本比旧版本快得多。
Upgrade to the latest version of the Maven Assembly plugin. Newer versions are much faster than older ones.