运行 重新创建 Dagger 2 注入文件的任务是什么

What task to run to re-create Dagger 2 injection files

当我更改 Dagger 2 组件时,我希望它重建注入 类。但我不想 运行 重建整个项目,因为这需要 5 分钟,即使使用 gradle 守护程序也是如此。

在某些情况下它会自动重建,但在其他情况下它不会。

我 运行 可以做什么 gradle 任务来重新创建 Dagger 2 文件?

您需要通过 运行 apt 插件生成源文件。在编译您的源代码时会发生这种情况。使用 gradlew compileDebugSources 触发编译或在 IDE.

中使用 Make Project

如果你想检查 sources,你可以看到它附加到 javaCompile 任务。

另见 How to trigger the minimal task on Gradle to run apt plugin