Zip task creates a file in root named ".zip"

I have xml files that have been copied into (root)/build and a task defined as follows but the result of this, which from what I’ve read should put an zip file into /build/distribution/(project.name)-(project.version).zip just results in a file name “.zip” in the root. It has all the right content though.

task archive(type: Zip) {
 from "build"
 exclude "*.zip"
}

I ended up resolving this doing the following - it wasn’t all that clear and maybe the behavior was changed for 2.2.1 vs. 2.1.0 but the defaults are terrible in 2.1.0 from my experience, i.e. archiveName = nothing.

task archive(type: Zip) {
  archiveName = "${project.name}.zip"
 destinationDir = file('build/archive')
    from 'build/output'
 exclude "*.zip"
    includeEmptyDirs = false
}

According to the documentation, defaults are only applied to task within projects with the ‘java’ plugin. This is actually incorrect, as it is the ‘base’ plugin that applies these defaults. If you are creating a non-java gradle project and still want some reasonable default conventions added (build directories, clean and assemble tasks, etc) just add the following.

apply plugin: ‘base’