why can quotes be left out in names of gradle tasks


I don't understand why we don't need to add quotes to the name of gradle task when we declare it like:

task hello (type : DefaultTask) { }

I've tried in a groovy project and found that it's illegal, how gradle makes it works. And I don't understand the expression above neither, why we can add (type : DefaultTask), how can we analyze it with groovy grammar?


As an example in a GroovyConsole runnable form, you can define a bit of code thusly:

// Set the base class for our DSL @BaseScript(MyDSL) import groovy.transform.BaseScript // Something to deal with people class Person { String name Closure method String toString() { "$name" } Person(String name, Closure cl) { this.name = name this.method = cl this.method.delegate = this } def greet(String greeting) { println "$greeting $name" } } // and our base DSL class abstract class MyDSL extends Script { def methodMissing(String name, args) { return new Person(name, args[0]) } def person(Person p) { p.method(p) } } // Then our actual script person tim { greet 'Hello' }

So when the script at the bottom is executed, it prints Hello tim to stdout

But David's answer is the correct one, this is just for example

<a href="http://docs.groovy-lang.org/docs/latest/html/documentation/core-domain-specific-languages.html" rel="nofollow">See also here in the documentation for Groovy</a>


A Gradle build script is a Groovy DSL application. By careful use of "methodMissing" and "propertyMissing" methods, all magic is possible.

I don't remember the exact mechanism around "task ". I think this was asked in the Gradle forum (probably more than once).


  • Facebook Feed Dialog Returns API Error Code: 191
  • After unpublishing an app on Google Play, will users still be able to buy inapps?
  • DataTrigger with VisualStates in Windows phone 8.1
  • Streaming AAC+ (inside FLV) on iOS using AIR
  • How to exclude certain enumerations from all enumeration types
  • Thread safe singleton in C++
  • How to create 2 svg's on one page?
  • AppEngine Paypal integration giving SSLCertificateError on localhost, using Python
  • Windows 8 Flexboxes - Nesting Flexboxes with overflow enabled
  • device tree overlay phandle
  • Passing HTTP Post from AWS API GW to Lambda
  • Get spring boot pagination number starts from 1 instead of 0
  • How to implement Google Drive and Google Plus sdk in ios project
  • Failed to resolve: firebase-auth-15.0.0 [closed]
  • Query regarding com.jcraft.jsch.JSchException: UnknownHostKey: x.y.com. DSA key fingerprint is “ac:e
  • Query takes almost two seconds but matches only two rows - why isn't the index helping?
  • Thumbnails for mxml components in Flex
  • getting the class name of an HTML tag using XPATH
  • Can I read another applications memory?
  • Possible to set default CloudKit container not based on application name?
  • What Exception is thrown on timeout?
  • gnuplot - How to make zmin equal to zmax keeeping autoscale on z axis
  • LinkedIn API: Access Denied when getting Access Token
  • Print Longitude and Latitude in textbox Android
  • Cloud Code: Creating a Parse.File from URL
  • Terminal run dalvikvm with am.jar
  • Android: Unable to detect vertical plane
  • How to handle div that is created dynamically in a table
  • Send array to next viewcontroller iOs xcode [duplicate]
  • Debug `Unexpected end of JSON input Error` on content script
  • Apple Mach-O Linker error (“duplicate symbol”)
  • Make checkout phone field optional for specific countries in WooCommerce
  • Codeigniniter insert data through models and controller
  • Cross compile glibc for arm, got undefined reference to some unwind functions
  • Angular FormGroup won't update it's value immediately after patchValue or setValue
  • PHP Permalinks.. how to change?
  • What does the “id” field in an Android “Google Play Music” broadcast intent correspond to?
  • ReferenceError: TextEncoder is not defined