Gradle System Commands Cheatsheet

Printer-friendly versionPDF version

So I was reading this book "Gradle in Action" and thought I'd jolt down the more interesting technical niceties here. For your theory part I would recommend reading the book. The source code though is available freely for the book on github.

Useful Gradle command line options

gradle -q  // quiet mode
gradle -h  // help
gradle -i // info
gradle -s // error stacktrace
gradle -is // combine options
gradle -Dprop=value  // system property
gradle -Pprop=value  // project property

Gradle Daemon

gradle --daemon  // For faster subsequent runs, timesout after 3hrs inactivity
gradle --stop
gradle --non-daemon  // Use anytime to run without using the daemon process

Listing Gradle Tasks/Properties/Projects

If you want to list the tasks in a gradle file type as below and it will show you the tasks divided neatly in different sections (Setup, Helpers, Named Groups by you and other sections)

gradle tasks
gradle tasks --all   // to see all the tasks really
gradle -q tasks --all  // q option for quieter log output
gradle properties  // List property values used by the gradle file
gradle projects  // for multi project systems

Excluding a task

gradle execThisTask -x donotExecThisTask

Analyzing Dependencies

From the tree that gets printed (*) says, library pulled already by top level dependency. v1 -> v2 say conflict resolved by pulling v2 version of library when v1 was requested.

gradle dependencies
gradle --offline  // Run in offline mode while travelling for e.g.
gradle -q dependencyInsight --configuration THENAME --dependency  // inverted dependency graph
gradle --refresh-dependencies  // to refresh the dependencies from repository





Top level category:

Add new comment