title: Gradle publishing only if it is a release
body: <p>I have two maven repositories one local and one external.</p>
  
  <p>On my local repository, I will publish snapshots and releases.
  On the external repository, I will publish only releases.</p>
  
  <p>My current code in build.gradle for publishing:</p>
  
  <pre><code>publishing {
      ...
  
      repositories {
          maven { // Local Nexus Repository
              ...
  
              def releaseRepoUrl = "...//repository/maven-releases/"
              def snapshotsRepoUrl = "...//repository/maven-snapshots/"
  
              url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releaseRepoUrl
          }
  
          maven { // external Nexus Repository (only publish if it is a release)
              ...
  
              def releaseRepoUrl = "...//repository/maven-releases/"
  
              url = version.endsWith('SNAPSHOT') ? "" : releaseRepoUrl
          }
      }
  }
  </code></pre>
  
  <p>The problem is that if the url is "" an error occurs what's logical because he can't publish to this url.</p>
  
  <p>How can I skip the publishing on the external repository if it is a SNAPSHOT?</p>