Gradle Refresh

 - move common functions to functions.gradle
 - use dependency aliases whenever possible
 - update to gradle 2.1
 - cleanup build.gradle files with proper spacing
 - remove duplicated blocks
 - compile incrementally (java)