After releasing several open-source projects which are not using maven for the build framework (they use gradle), I was faced with the harsh reality that if you don't use maven, it is pretty hard to automate the process. The current version of gradle allows you to upload to a maven compatible repo, but to upload to maven central there are some constraints (like pgp signing) that gradle does not (currently) support. In order to publish your artifacts to maven central via Sonatype (unclear if there is another way to be honest), you need to follow the instructions on how to set it up (you need to create a Jira Ticket). You also need to have a pgp key and if you don't, you can follow these instructions. Using gradle, you can simply create a maven compatible layout of your artifacts:
// example for one of my project
uploadArchives {
  repositories {
   mavenDeployer {
    repository(url: "file://localhost/my/local/repo")
    pom.whenConfigured { pomToConfigure ->
      pomToConfigure.project {
        name project.name
        description "A useful set of gradle plugins"
        url "http://github.com/pongasoft/gradle-plugins"
        licenses {
          license {
            name "The Apache Software License, Version 2.0"
            url "http://www.apache.org/licenses/LICENSE-2.0"
          }
        }
        developers {
          developer {
            id "ypujante"
            name "Yan Pujante"
            email "yan@pongasoft.com"
          }
        }
        scm {
          connection "scm:git:${spec.scmUrl}"
          developerConnection "scm:git:${spec.scmUrl}"
          url spec.scmUrl
        }
      }
    }
  }
}
Note that a big part of the previous code is setting up the right information in the pom file to comply with the set of requirements. Also note that you do not need to use gradle at all as long as you generate a maven compatible layout (with pom files). You can then use the script I have 'gisted' on github: maven_staging_upload.groovy. The script simply takes the pom files you want to upload as an input and will prompt you for your pgp passphrase only once! Make sure you follow the initial setup:
/**
 * This script uploads all your artifacts to maven.
 * 
 * To run this script there are several asumptions:
 * - gpg is installed and available in the path
 * - you have followed the instructions to set up your pgp key
 *   (http://www.sonatype.com/people/2010/01/how-to-generate-pgp-signatures-with-maven/)
 * - maven is installed and available in the path
 * - you have defined the proper server section in your ~/.m2/settings.xml file:
 *   <settings>
 *    ...
 *    <servers>
 *       <server>
 *        <id>nexus-releases</id>
 *        <username>ypujante</username>
 *        <password>********</password>
 *       </server>
 *     </servers>
 *    ...
 *   </settings>
 *
 * You run the script this way: groovy maven_staging_upload.groovy pathToPomFile1 pathToPomFile2...
 *
 * groovy
 */
You then need to login to Nexus to verify that the upload worked properly. You can then close the staging repository and release it. It will make its way to maven central shortly. The very first time, you need to activate central sync! I guess it is not fully automated as you still need to manually close/release the staging repository but the painful part (the part about uploading the artifacts to staging) is fully automated thanks to gradle and the script. You can use the gradle plugins that I open sourced to help with the release: the org.linkedin.repository and org.linkedin.release plugin can simplify your build code (for example the plugin takes care of the javadoc and sources requirements). Note that this script can be used totally independently of gradle and you do not need to use gradle to use it! Thanks to Jakub Holy for this blog post which helped me in understanding the steps I needed to follow in order to automate them. I am also hopeful that the 1.0 release of gradle will render my script obsolete!