gradle-http-plugin icon indicating copy to clipboard operation
gradle-http-plugin copied to clipboard

Does not work inside of a doLast block

Open lbenedetto opened this issue 6 years ago • 2 comments

I wrote a dead simple post request and tested that it works. Only issue was that it ran every time I synced my project. So I put it inside of a doLast block, and now I get this error message:

A configuration closure or consumer must be provided either globally or by the task configuration

task exportTranslations(group: "crowdin", type: HttpTask) {
    doLast {
        config {
            request.uri = "https://api.crowdin.com/api/project/$PROJECT_IDENTIFIER/export?key=$API_KEY"
        }
        post {
            response.success {
                println("Export successful")
            }
        }
    }
}

lbenedetto avatar Feb 11 '19 15:02 lbenedetto

Thanks. I have flagged it as a bug. You are welcome to provide a fix if you want. :-)

cjstehno avatar Feb 11 '19 20:02 cjstehno

I was able to work around it by using doFirst instead

lbenedetto avatar Feb 12 '19 11:02 lbenedetto