我正在查看gradle上的文档,并且正在寻找它发现时可能引起的问题。 7.5.5. What can go wrong with Daemon?
该声明最重要的是:
It is also possible to destabilize the Daemon (and build environment in general) by running builds that do not release resources correctly. This is a particularly poignant problem when using Microsoft Windows as it is less forgiving of programs that fail to close files after reading or writing.
然后我看到By default, the build cache is not enabled.与以下语句非常矛盾:
The Daemon is a long-lived process, so not only are we able to avoid the cost of JVM startup for every build, but we are able to cache information about project structure, files, tasks, and more in memory.
在这里找到:7.1. Why the Gradle Daemon is important for performance
后来我运行
gradle build --scan
并确认缓存实际上已禁用。实际上,唯一启用的守护进程开关是守护进程。因此,据我了解,使gradle作为构建工具更快的是其缓存先前构建的能力,但是默认情况下它是禁用的,因此除非启用缓存,否则它实际上与
mvn clean install -DskipTests
一样,在构建性能方面也是如此。
最佳答案
您的报价:
The Daemon is a long-lived process, so not only are we able to avoid the cost of JVM startup for every build, but we are able to cache information about project structure, files, tasks, and more in memory.
几乎可以回答您的问题。那是在谈论元数据,而不是缓存实际生成的文件内容。重复构建一个项目以测试较小的更改时,它仍然对速度有很大帮助。
关于maven - 如果默认情况下禁用了构建缓存,gradle守护程序有哪些优势?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48148147/