且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在java项目中使用gradle build只编译更改的文件

更新时间:2023-10-17 11:29:04

Gradle 现在支持避免编译,并且从更早开始就支持增量编译.您无需执行任何操作即可享受这些功能.只需更新 Gradle.请参阅https://blog.gradle.org/incremental-compiler-avoidance>

I am using gradle to build a java project.

I see that whenever there is a change in one java file entire projects gets rebuilt. Is there a way to compile only affected java files instead of all the files.

Gradle now supports compile avoidance, and has support for incremental compilation since earlier. You do not have to do anything to enjoy these features. Just update Gradle. See https://blog.gradle.org/incremental-compiler-avoidance