任务buildNeeded的用例?

时间:2022-01-03 02:17:22

I don't understand why there is the task 'buildNeeded' which is provided by the java plugin. Does not task 'build' solve the problem? The gradle documentation says:

我不明白为什么有一个由java插件提供的任务'buildNeeded'。任务“构建”不解决问题吗? gradle文档说:

buildNeeded: Performs a full build of the project and all projects it depends on.

buildNeeded:执行项目的完整构建及其依赖的所有项目。

and

build: Performs a full build of the project.

build:执行项目的完整版本。

Should / does not the task 'build' compile and build all the necessary things? Why to distinguish between 'build' and 'buildNeeded'?

是否应该“构建”任务编译并构建所有必要的东西?为什么要区分'build'和'buildNeeded'?

2 个解决方案

#1


8  

buildNeeded runs a full build for all projects that a project depends on. In particular it runs test for the depended-on projects, which can make sense if you want to play it safe. By comparison, build only runs a minimum set of tasks for the depended-on projects (e.g. jar), just enough to satisfy the dependency. build is used more often than buildNeeded.

buildNeeded为项目所依赖的所有项目运行完整构建。特别是它为依赖项目运行测试,如果你想安全地发挥它,这是有意义的。相比之下,build只为依赖项目(例如jar)运行一组最小的任务,足以满足依赖性。 build比buildNeeded更常用。

#2


1  

build does not call a full build on all child projects.

build不会调用所有子项目的完整构建。

If you project has no dependent projects it doesn't make any difference.

如果你的项目没有依赖项目,它没有任何区别。

The idea is that if you change API within a parent project you want to recompile all child projects with the new one.

我们的想法是,如果您在父项目中更改API,则需要使用新项目重新编译所有子项目。

#1


8  

buildNeeded runs a full build for all projects that a project depends on. In particular it runs test for the depended-on projects, which can make sense if you want to play it safe. By comparison, build only runs a minimum set of tasks for the depended-on projects (e.g. jar), just enough to satisfy the dependency. build is used more often than buildNeeded.

buildNeeded为项目所依赖的所有项目运行完整构建。特别是它为依赖项目运行测试,如果你想安全地发挥它,这是有意义的。相比之下,build只为依赖项目(例如jar)运行一组最小的任务,足以满足依赖性。 build比buildNeeded更常用。

#2


1  

build does not call a full build on all child projects.

build不会调用所有子项目的完整构建。

If you project has no dependent projects it doesn't make any difference.

如果你的项目没有依赖项目,它没有任何区别。

The idea is that if you change API within a parent project you want to recompile all child projects with the new one.

我们的想法是,如果您在父项目中更改API,则需要使用新项目重新编译所有子项目。