Collection of common gradle patterns and example projects.
- If you run gradle often, make sure you use gradle --daemon. This will run a gradle daemon in the background and not spin up a new java/groovy vm for each gradle command. If you always want to use it, you can also create an alias:
alias gradle='gradle --daemon'
- For committing, I use the following alias:
alias gcommit='git pull --rebase && gradle build && git push'
- If you want to force refresh of dependencies, use
gradle refresh-dependencies
- How to generate a new project quickly
- Simple common setup, see build.gradle
- Adding behaviour to certain stages, for example extended output when running tests
- Playing around with strict dependency management
- Building a small library uploadable to some repository
- Multi project setup using parent build.gradle and settings.gradle
- Including shared fragments using apply-from (if you don't want your projects within one giant git repository). Note that dependencies other than those defined via a central repository do not work this way. Useful links are
Just for completeness, this is what I'm using for these examples:
- MacBook Pro/OSX Mavericks
- Git as VCS
- Java 1.7 for example code
- Gradle 1.9 (all examples should work with any version >= 1.8)
- IntelliJ Idea 13 Ultimate (all examples should work with any version >= 11)