返回介绍

获取构建信息 - 任务列表

发布于 2020-07-06 13:40:56 字数 6564 浏览 1147 评论 0 收藏 0

执行 gradle tasks 命令会列出项目中所有任务.
这会显示项目中所有的默认任务以及每个任务的描述.

例 11.9 获取任务信息

gradle -q tasks 命令的输出

  1. > gradle -q tasks
  2. ------------------------------------------------------------
  3. All tasks runnable from root project
  4. ------------------------------------------------------------
  5. Default tasks: dists
  6. Build tasks
  7. -----------
  8. clean - Deletes the build directory (build)
  9. dists - Builds the distribution
  10. libs - Builds the JAR
  11. Build Setup tasks
  12. -----------------
  13. init - Initializes a new Gradle build. [incubating]
  14. wrapper - Generates Gradle wrapper files. [incubating]
  15. Help tasks
  16. ----------
  17. dependencies - Displays all dependencies declared in root project 'projectReports'.
  18. dependencyInsight - Displays the insight into a specific dependency in root project 'projectReports'.
  19. help - Displays a help message
  20. projects - Displays the sub-projects of root project 'projectReports'.
  21. properties - Displays the properties of root project 'projectReports'.
  22. tasks - Displays the tasks runnable from root project 'projectReports' (some of the displayed tasks may belong to subprojects).
  23. To see all tasks and more detail, run with --all.

默认情况下,这只会显示那些被分组的任务.
你可以通过为任务设置 group 属性和 description 来把 这些信息展示到结果中.

例 11.10. 更改任务报告内容

build.gradle

  1. dists {
  2. description = 'Builds the distribution'
  3. group = 'build'
  4. }

当然你也可以用 —all 参数来收集更多任务信息.
这会列出项目中所有任务以及任务之间的依赖关系.

例 11.11 获得更多的任务信息

gradle -q tasks —all 命令的输出

  1. > gradle -q tasks --all
  2. ------------------------------------------------------------
  3. All tasks runnable from root project
  4. ------------------------------------------------------------
  5. Default tasks: dists
  6. Build tasks
  7. -----------
  8. clean - Deletes the build directory (build)
  9. api:clean - Deletes the build directory (build)
  10. webapp:clean - Deletes the build directory (build)
  11. dists - Builds the distribution [api:libs, webapp:libs]
  12. docs - Builds the documentation
  13. api:libs - Builds the JAR
  14. api:compile - Compiles the source files
  15. webapp:libs - Builds the JAR [api:libs]
  16. webapp:compile - Compiles the source files
  17. Build Setup tasks
  18. -----------------
  19. init - Initializes a new Gradle build. [incubating]
  20. wrapper - Generates Gradle wrapper files. [incubating]
  21. Help tasks
  22. ----------
  23. dependencies - Displays all dependencies declared in root project 'projectReports'.
  24. api:dependencies - Displays all dependencies declared in project ':api'.
  25. webapp:dependencies - Displays all dependencies declared in project ':webapp'.
  26. dependencyInsight - Displays the insight into a specific dependency in root project 'projectReports'.
  27. api:dependencyInsight - Displays the insight into a specific dependency in project ':api'.
  28. webapp:dependencyInsight - Displays the insight into a specific dependency in project ':webapp'.
  29. help - Displays a help message
  30. api:help - Displays a help message
  31. webapp:help - Displays a help message
  32. projects - Displays the sub-projects of root project 'projectReports'.
  33. api:projects - Displays the sub-projects of project ':api'.
  34. webapp:projects - Displays the sub-projects of project ':webapp'.
  35. properties - Displays the properties of root project 'projectReports'.
  36. api:properties - Displays the properties of project ':api'.
  37. webapp:properties - Displays the properties of project ':webapp'.
  38. tasks - Displays the tasks runnable from root project 'projectReports' (some of the displayed tasks may belong to subprojects).
  39. api:tasks - Displays the tasks runnable from project ':api'.
  40. webapp:tasks - Displays the tasks runnable from project ':webapp'.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文