title: How to use Maven to only sign three jars and push them to Maven Central?
body: <p><em>UPDATE: See <a href="https://stackoverflow.com/questions/24784749/followup-questions-using-maven-to-only-sign-and-deploy-jars-to-maven-central-b">followup question</a></em></p>
  
  <hr>
  
  <p>I have a Java library whose build process is entirely written in Ant. The project's sandbox (the source directory, in which I edit the code) is</p>
  
  <pre><code>R:\jeffy\programming\sandbox\xbnjava\
  </code></pre>
  
  <p>Its build (output) directory is</p>
  
  <pre><code>R:\jeffy\programming\build\xbnjava-0.1.1\
  </code></pre>
  
  <hr>
  
  <p>This is what my goal is:</p>
  
  <ol>
  <li><p><code>ant cleanpublish</code>: Builds the project from scratch, including creating these three jars</p>
  
  <ul>
  <li><code>mylibrary-0.1.1.jar</code></li>
  <li><code>mylibrary-0.1.1-sources.jar</code></li>
  <li><code>mylibrary-0.1.1-javadoc.jar</code></li>
  </ul>
  
  <p>which are placed into</p>
  
  <pre><code>R:\jeffy\programming\build\xbnjava-0.1.1\download
  </code></pre>
  
  <p>This part is done and works well. These three jars are <a href="http://central.sonatype.org/pages/requirements.html#supply-javadoc-and-sources" rel="nofollow noreferrer">as required</a> by Maven Central (scroll up a tiny bit to see it).</p></li>
  <li><p>Check the version into GitHub and upload the build directory to my web server. I have also completed this step.</p></li>
  <li><p><code>mvn deploy</code>: The <em>only</em> thing this needs to do is sign the three jars and push them to Maven Central. This is the current bane of my existence.</p></li>
  </ol>
  
  <hr>
  
  <p>These are the steps I've taken so far: I have</p>
  
  <ol>
  <li><a href="http://central.sonatype.org/pages/ossrh-guide.html#initial-setup" rel="nofollow noreferrer">Set up my project</a> at sonatype,</li>
  <li><a href="http://www.gpg4win.org/doc/en/gpg4win-compendium_12.html" rel="nofollow noreferrer">Created my public key</a> with <a href="http://www.gpg4win.org" rel="nofollow noreferrer">gpg4win</a> (<a href="http://central.sonatype.org/pages/working-with-pgp-signatures.html" rel="nofollow noreferrer">related documentation</a> on sonatype)</li>
  <li><a href="http://maven.apache.org/download.cgi" rel="nofollow noreferrer">Downloaded</a> and <a href="http://maven.apache.org/download.cgi#installation" rel="nofollow noreferrer">installed Maven</a></li>
  <li><p>Set up what I <em>hope</em> is a <a href="https://stackoverflow.com/questions/2941605/sample-settings-xml-for-maven/2941625#2941625">correct <code>settings.xml</code></a>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"&gt;
     &lt;servers&gt;
        &lt;server&gt;
           &lt;id&gt;sonatype-nexus-snapshots&lt;/id&gt;
           &lt;username&gt;MY_SONATYPE_USERNAME&lt;/username&gt;
           &lt;password&gt;MY_SONATYPE_PASSWORD&lt;/password&gt;
        &lt;/server&gt;
        &lt;server&gt;
           &lt;id&gt;sonatype-nexus-staging&lt;/id&gt;
           &lt;username&gt;MY_SONATYPE_USERNAME&lt;/username&gt;
           &lt;password&gt;MY_SONATYPE_PASSWORD&lt;/password&gt;
        &lt;/server&gt;
     &lt;/servers&gt;
     &lt;pluginGroups&gt;&lt;/pluginGroups&gt;
     &lt;proxies&gt;&lt;/proxies&gt;
     &lt;mirrors&gt;&lt;/mirrors&gt;
     &lt;profiles&gt;&lt;/profiles&gt;
  &lt;/settings&gt;
  </code></pre></li>
  </ol>
  
  <p>(This file is stored in <code>R:\jeffy\programming\sandbox\settings.xml</code>, as it's used by every one of my projects.)</p>
  
  <ol start="4">
  <li>Set up at least the beginning of my <code>pom.xml</code>, based on <a href="http://code.google.com/p/ez-vcard/source/browse/trunk/pom.xml" rel="nofollow noreferrer">the one in <code>ez-vcard</code></a> (as referenced in <a href="https://stackoverflow.com/users/13379/michael">the author's</a> helpful <a href="http://mangstacular.blogspot.com/2012/10/deploying-to-maven-central.html" rel="nofollow noreferrer">blog post</a>). I also used Maven's <a href="http://maven.apache.org/guides/introduction/introduction-to-the-pom.html" rel="nofollow noreferrer">introduction to the POM</a> as a guide.</li>
  </ol>
  
  <p>These parts, at the top, I believe I understand:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
     &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
     &lt;groupId&gt;com.github.xbn&lt;/groupId&gt;
     &lt;artifactId&gt;xbnjava&lt;/artifactId&gt;
     &lt;packaging&gt;jar&lt;/packaging&gt;
     &lt;version&gt;0.1.2-SNAPSHOT&lt;/version&gt;
     &lt;name&gt;XBN-Java&lt;/name&gt;
     &lt;url&gt;https://github.com/aliteralmind/xbnjava&lt;/url&gt;
     &lt;inceptionYear&gt;2014&lt;/inceptionYear&gt;
     &lt;organization&gt;
        &lt;name&gt;Jeff Epstein&lt;/name&gt;
     &lt;/organization&gt;
     &lt;description&gt;XBN-Java is a collection of generically-useful backend (server side, non-GUI) programming utilities, featuring RegexReplacer and FilteredLineIterator. XBN-Java is the foundation of Codelet (http://codelet.aliteralmind.com).&lt;/description&gt;
  
     &lt;parent&gt;
        &lt;groupId&gt;org.sonatype.oss&lt;/groupId&gt;
        &lt;artifactId&gt;oss-parent&lt;/artifactId&gt;
        &lt;version&gt;7&lt;/version&gt;
     &lt;/parent&gt;
  
     &lt;licenses&gt;
        &lt;license&gt;
           &lt;name&gt;Lesser General Public License (LGPL) version 3.0&lt;/name&gt;
           &lt;url&gt;https://www.gnu.org/licenses/lgpl-3.0.txt&lt;/url&gt;
        &lt;/license&gt;
        &lt;license&gt;
           &lt;name&gt;Apache Software License (ASL) version 2.0&lt;/name&gt;
           &lt;url&gt;http://www.apache.org/licenses/LICENSE-2.0.txt&lt;/url&gt;
        &lt;/license&gt;
     &lt;/licenses&gt;
  
     &lt;developers&gt;
        &lt;developer&gt;
           &lt;name&gt;Jeff Epstein&lt;/name&gt;
           &lt;email&gt;aliteralmind-github@yahoo.com&lt;/email&gt;
           &lt;roles&gt;
              &lt;role&gt;Lead Developer&lt;/role&gt;
           &lt;/roles&gt;
        &lt;/developer&gt;
     &lt;/developers&gt;
  
     &lt;issueManagement&gt;
        &lt;system&gt;GitHub Issue Tracker&lt;/system&gt;
        &lt;url&gt;https://github.com/aliteralmind/xbnjava/issues&lt;/url&gt;
     &lt;/issueManagement&gt;
  
     &lt;scm&gt;
        &lt;connection&gt;scm:git:git@github.com:aliteralmind/xbnjava.git&lt;/connection&gt;
        &lt;url&gt;scm:git:git@github.com:aliteralmind/xbnjava.git&lt;/url&gt;
        &lt;developerConnection&gt;scm:git:git@github.com:aliteralmind/xbnjava.git&lt;/developerConnection&gt;
     &lt;/scm&gt;
  
     &lt;properties&gt;
        &lt;java.version&gt;1.7&lt;/java.version&gt;
     &lt;/properties&gt;
  </code></pre>
  
  <p>The rest of it, I'm not so sure:</p>
  
  <pre><code>  &lt;profiles&gt;
       &lt;!--
       This profile will sign the JAR file, sources file, and javadocs file using the GPG key on the local machine.
       See: https://docs.sonatype.org/display/Repository/How+To+Generate+PGP+Signatures+With+Maven
       --&gt;
       &lt;profile&gt;
          &lt;id&gt;release-sign-artifacts&lt;/id&gt;
          &lt;activation&gt;
             &lt;property&gt;
                &lt;name&gt;release&lt;/name&gt;
                &lt;value&gt;true&lt;/value&gt;
             &lt;/property&gt;
          &lt;/activation&gt;
          &lt;build&gt;
             &lt;plugins&gt;
                &lt;plugin&gt;
                   &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                   &lt;artifactId&gt;maven-gpg-plugin&lt;/artifactId&gt;
                   &lt;version&gt;1.4&lt;/version&gt;
                   &lt;executions&gt;
                      &lt;execution&gt;
                         &lt;id&gt;sign-artifacts&lt;/id&gt;
                         &lt;phase&gt;package&lt;/phase&gt;
                         &lt;goals&gt;
                            &lt;goal&gt;sign&lt;/goal&gt;
                         &lt;/goals&gt;
                      &lt;/execution&gt;
                   &lt;/executions&gt;
                &lt;/plugin&gt;
             &lt;/plugins&gt;
          &lt;/build&gt;
       &lt;/profile&gt;
    &lt;/profiles&gt;
  &lt;/project&gt;
  </code></pre>
  
  <hr>
  
  <p>What do I need to do to complete the POM, whose path is</p>
  
  <pre><code>R:\jeffy\programming\sandbox\xbnjava\pom.xml
  </code></pre>
  
  <p>so it signs and pushes these three jar files, as located in</p>
  
  <pre><code>R:\jeffy\programming\build\xbnjava-0.1.1\download\
  </code></pre>
  
  <p>to Maven Central?</p>
  
  <p>I would really appreciate some advice on where to go from here. I have been swimming in nothing but Maven documentation for three days now, and I'm lost and frustrated. This is my third attempt over the past few years with Maven, and each time it's gone very badly.</p>
  
  <p>(I originally attempted to <a href="http://central.sonatype.org/pages/apache-ant.html" rel="nofollow noreferrer">fulfill Maven requirements with Ant tasks</a>, but I decided to instead completely separate my Ant build and the Maven sign-the-jars-and-push-to-Maven-Central portion. This is to learn something new, but also because it seems like implementing Maven within Ant is less of a standard than is just pure Maven.)</p>
  
  <p>Thank you for helping me.</p>