Gradle 项目能否重建其依赖项、跟踪其源更改等?

Can a Gradle project rebuild its dependencies, track their source changes etc.?

我习惯于在 ant/Netbeans 中指定项目依赖项,如果项目的依赖项(另一个,否则是单独的项目)发生变化,项目会重新编译,"clean and build" 会清理并重建依赖项等。还有源代码代码导航,Netbeans 在项目之间无缝切换。

现在我想学习 Gradle,但我被告知我应该使用存储库来访问依赖项,例如 Maven Central。如果是 Gradle 项目,Netbeans UI 中的项目依赖项配置已消失。因此问题是:在 Gradle 项目中,上述项目及其依赖项之间深度集成的可能性是否可能?

对于您的项目源,这意味着典型 src/main/java、Gradle 下的内容将 "cache" 对于大多数内置任务来说都是开箱即用的。

在 Gradle 中,这被称为 Up-to-date checks (AKA Incremental Build):

Once your source files have been compiled, there should be no need to recompile them unless something has changed that affects the output, such as the modification of a source file or the removal of an output file.

如果您定义了自定义构建任务或需要增量(缓存)的任务,那么您需要按照this使您的自定义任务增量。

以及以下内容:

"clean and build" cleans and rebuilds dependencies etc.

Gradle 没有 "build" 依赖项。它将 retrieve dependencies from the configured repositories in the project and then cache them.

您可以根据需要配置构建缓存:https://docs.gradle.org/current/userguide/build_cache.html#sec:build_cache_configure