简体   繁体   English

如何在没有任何依赖性检查的情况下运行 gradle?

[英]How do I gradle run without any dependency checking?

We have a complex set of build.gradle scripts.我们有一组复杂的 build.gradle 个脚本。

Is it possible to run a task without dependency checking of any kind?是否可以在不进行任何类型的依赖性检查的情况下运行任务?

eg例如

gradle run

should just start the jvm and nothing else?应该只启动 jvm 而不是别的吗?

Thank you.谢谢你。

If you want to exclude module dependencies, there is a -a , or --no-rebuild option to skip other subprojects/modules. 如果要排除模块依赖性,则可以使用-a--no-rebuild选项来跳过其他子项目/模块。

If you want to skip the compilation, or resources tasks, you can use the -x option. 如果要跳过编译或资源任务,则可以使用-x选项。

If running on bash, you can skip all dependencies like this如果在 bash 上运行,你可以像这样跳过所有依赖

./gradlew test $(./gradlew test --dry-run | awk '/^:/ { print "-x" $1 }' | sed '$ d')

What this does is simply它的作用很简单

  • to do a dry-run of the build, to detect all dependencies and进行构建的空运行,检测所有依赖项和
  • build a command line with all required -x flags.使用所有必需的 -x 标志构建命令行。

Notice:注意:

  • you can use the Gradle --console plain flag if you want to see the initial output without the pretty-print features of Gradle你可以使用 Gradle --console plain标志如果你想看到最初的 output 而没有 Gradle 的漂亮打印功能
  • the sed allows to skip the last line... awk being quite complex to do the same... sed 允许跳过最后一行...... awk 做同样的事情相当复杂......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM