Skip to content

Instantly share code, notes, and snippets.

@qrtt1 qrtt1/
Last active Dec 26, 2015

What would you like to do?

Gradle Notes

Links About the Gralde's task keyword





[groovy CompilationUnit](\(org.codehaus.groovy.control.CompilationUnit.SourceUnitOperation, int))


task foo(type:SomeType) {

當這麼寫的時候,TaskContainer 會把 task 建成 SomeType 的 Task,而非 DefaultTask。這就叫 enhanced task !?

Convention vs Extension

Extensions and conventions are similar (but not identical) ways to dynamically extend the build model. Extensions are the newer concept and have largely replaced conventions. In short, only use extensions, don't use conventions.

You should prefer the extension mechanism over the convention object mechanism. We will migrate the built-in plugins over time and new plugins will use the extension mechanism. The announce, ide, and c++ plugins all use extensions rather than convention objects.

However, the convention object mechanism is not going away any time soon. We will probably offer some migration mechanism, so that you can use both, and Gradle will warn the plugin users that they should use the new syntax for accessing the properties, rather than the new syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.