// tag::all[]
import org.apache.commons.codec.binary.Base64

// tag::declare-classpath[]
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath group: 'commons-codec', name: 'commons-codec', version: '1.2'
    }
}
// end::declare-classpath[]

task encode {
    doLast {
        def byte[] encodedString = new Base64().encode('hello world\n'.getBytes())
        println new String(encodedString)
    }
}
// end::all[]
