Where is the assemble task documented?

After reading Gradle in Action (I highly recommend it), I am more than ever eager to use gradle.

Here is ‘’‘build.gradle’’’:

plugins {
  id 'base'
artifacts {
  archives file('file.txt')

Type: ‘’‘gradle tasks’’’, there is an ‘’‘assemble’’’ task. Type: ‘’‘gradle assemble’’’, no file is created. Why?

Where is the documentation for ‘’‘assemble’’’ so I can get it to do something? Please do not say ‘’‘apply plugin: ‘java’’’’ I don’t use Java nor a language listed on tiobe.com


To be honest, the base plugin isn’t really documented. Generally, even with the ‘java’ plugin, the ‘assemble’ task itself doesn’t actually perform any work. It’s just a lifecycle task that other tasks attach themselves to. In this case, the file isn’t created because you haven’t defined a task to do so. If you were to a) define a task that created that output and b) tell gradle about that task, then running ‘gradle assemble’ would run the task responsible for creating that artifact.

plugins {

id ‘base’


task generateFile << {

file(‘file.txt’).text = ‘foo’


artifacts {

archives(file(‘file.txt’)) {

builtBy generateFile



Ok, thank you. Could you teach me a little bit more, I’d like to learn how to learn Gradle. With that in mind, let’s say I want to learn more about ‘’‘archives’’’ and ‘’‘builtBy’’’.

Based on the ArtifactHandler documentation:

<configurationName> <artifact-notation>, <artifact-notation> ...
<configurationName> <artifact-notation>
  { ... some code to configure the artifact }

The ‘’‘archives’’’ is a configuration name, but it looks like a task to me, so I am not sure what it is. Can you help me understand this please?

Next, and I think I got it right, I wanted to learn how you knew you could use ‘’‘builtBy’’’ to configure the ‘’‘archives’’’. So I went from the ArtifactHandler description add method: PublishArtifact add(String configurationName, Object artifactNotation, Closure configureClosure)

And without knowing how to find what the ‘’‘configureClosure’’’ could take in to configure the artifacts, I clicked on the the data type ‘’‘PublishArtifact’’’, which obviously took me to the ‘’‘PublishArtifact’’’ documentation, but there was no sign of ‘’‘builtBy’’’. However I noticed a link to a subinterface to ‘’‘ConfigurablePublishArtifact’’’, and that led me to a page that contained ‘’‘builtBy’’’. Bingo!

So does this mean that the closures are run against the data type returned by the task that recieves the closure as an argument?

Thanks again for your help.

You have it mostly right. In this case ‘archives’ is in fact a configuration, not a task. Technically speaking, ‘archives’ in this case represents a method, which takes an artifact notation as an argument, as well as a closure. As you can tell from the ‘ArtifactHandler’ documentation, it supports three different argument types, ‘AbstractArchiveTask’, ‘File’ or ‘Map’. As you eventually realized, when passing a ‘File’, the closure is then used to configure an instance of ‘ConfigurablePublishArtifact’ as described in the documentation:

A file artifact is represented using an instance of ConfigurablePublishArtifact

To answer your last question, yes, except again, it’s a method, not a task.