Is this the right way to upload a custom artifact?


(Christian Goetze) #1

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 {
  sourceArchive
  binaryArchive
}
  dependencies {
  sourceArchive "org.gnu:bash:4.2:src@tgz"
}
  task buildFromSource(type: Exec) {
  inputs.files configurations.sourceArchive.files
  outputs.file file("${project.name}-${project.version}.tgz")
  executable './build.sh'
  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.