gpt4 book ai didi

java - Gradle项目是否可以重建其依赖项,跟踪其源更改等?

转载 作者:行者123 更新时间:2023-12-03 03:41:10 25 4
gpt4 key购买 nike

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

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

最佳答案

对于您项目的源代码,这意味着通常src/main/java下的内容,Gradle会将这些内容“缓存”开来以用于大多数内置任务。

在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不会“构建”依赖项。它将从项目中已配置的 retrieve dependencies生成 repositories,然后是 cache them

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

关于java - Gradle项目是否可以重建其依赖项,跟踪其源更改等?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61668008/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com