Is this the right way to upload a custom artifact?

My goal is to use gradle to download a source tarball and its dependencies, run a shell script to build the source and publish the resulting binary tarball. I got this far:

apply plugin: 'maven'
  version 'testarch-4.2'
  repositories {
  maven {
    url "http://nexus/..."
  configurations {
  dependencies {
  sourceArchive "org.gnu:bash:4.2:src@tgz"
  task buildFromSource(type: Exec) {
  inputs.files configurations.sourceArchive.files
  outputs.file file("${}-${project.version}.tgz")
  executable './'
  def myArgs = configurations.sourceArchive.files.path
  myArgs.add(0, outputs.files.asPath)
  args myArgs
  artifacts {
  def outputFile = buildFromSource.outputs.files.singleFile
  println outputFile.path
  binaryArchive file: outputFile, name: 'bash'
  uploadArchives {
  configuration = configurations.binaryArchive
  repositories.mavenDeployer {
    repository(url: "http://nexus/..") {
      authentication(userName: "me", password: "secret!")
    pom.groupId = 'org.gnu'
  uploadArchives.dependsOn buildFromSource

The upload portion is failing with “400, missing entity” error from the Nexus server.

  • am I doing this the right way * any ideas on what I’m doing wrong?

Ultimately, I’d like to have a “build policy” for this situation.