Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I gradle run without any dependency checking?

We have a complex set of build.gradle scripts.

Is it possible to run a task without dependency checking of any kind?

e.g.

gradle run

should just start the jvm and nothing else?

Thank you.

like image 931
user674669 Avatar asked Nov 07 '25 17:11

user674669


2 Answers

If you want to exclude module dependencies, there is a -a, or --no-rebuild option to skip other subprojects/modules.

If you want to skip the compilation, or resources tasks, you can use the -x option.

like image 69
Adam Adamaszek Avatar answered Nov 09 '25 10:11

Adam Adamaszek


If running on bash, you can skip all dependencies like this

./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.

Notice:

  • you can use the Gradle --console plain flag if you want to see the initial output without the pretty-print features of Gradle
  • the sed allows to skip the last line... awk being quite complex to do the same...
like image 23
Yann Vo Avatar answered Nov 09 '25 10:11

Yann Vo