Merge "Update build files to not require some local properties."
diff --git a/builder/build.gradle b/builder/build.gradle
index 9156c4f..8408cf1 100644
--- a/builder/build.gradle
+++ b/builder/build.gradle
@@ -1,6 +1,4 @@
 apply plugin: 'java'
-apply plugin: 'eclipse'
-apply plugin: 'idea'
 apply plugin: 'maven'
 apply plugin: 'signing'
 
@@ -45,6 +43,9 @@
     }
 }
 
+project.ext.sonatypeUsername = project.hasProperty('sonatypeUsername') ? sonatypeUsername : ""
+project.ext.sonatypePassword = project.hasProperty('sonatypePassword') ? sonatypePassword : ""
+
 uploadArchives {
     repositories {
         mavenDeployer {
@@ -53,11 +54,15 @@
                     throw new StopExecutionException("uploadArchives must be called with the release.gradle init script")
                 }
 
+                if (ext.sonatypeUsername.length() == 0 || ext.sonatypePassword.length() == 0) {
+                    throw new StopExecutionException("uploadArchives cannot be called without sonatype username and password")
+                }
+
                 signing.signPom(deployment)
             }
 
             repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
-                authentication(userName: sonatypeUsername, password: sonatypePassword)
+                authentication(userName: project.ext.sonatypeUsername, password: project.ext.sonatypePassword)
             }
 
             // Discard all the dependencies from the POM, as they are packaged in the JAR.
@@ -118,5 +123,6 @@
 }
 
 signing {
+    required { project.has("release") && gradle.taskGraph.hasTask("uploadArchives") }
     sign configurations.archives
 }
diff --git a/gradle/build.gradle b/gradle/build.gradle
index 5f70389..ff5abd3 100644
--- a/gradle/build.gradle
+++ b/gradle/build.gradle
@@ -1,5 +1,4 @@
 apply plugin: 'groovy'
-apply plugin: 'idea'
 apply plugin: 'maven'
 apply plugin: 'signing'
 
@@ -64,6 +63,10 @@
 
 check.dependsOn integrationTest
 
+
+project.ext.sonatypeUsername = project.hasProperty('sonatypeUsername') ? sonatypeUsername : ""
+project.ext.sonatypePassword = project.hasProperty('sonatypePassword') ? sonatypePassword : ""
+
 uploadArchives {
     repositories {
         mavenDeployer {
@@ -72,11 +75,15 @@
                     throw new StopExecutionException("uploadArchives must be called with the release.gradle init script")
                 }
 
+                if (project.ext.sonatypeUsername.length() == 0 || project.ext.sonatypePassword.length() == 0) {
+                    throw new StopExecutionException("uploadArchives cannot be called without sonatype username and password")
+                }
+
                 signing.signPom(deployment)
             }
 
             repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
-                authentication(userName: sonatypeUsername, password: sonatypePassword)
+                authentication(userName: project.ext.sonatypeUsername, password: project.ext.sonatypePassword)
             }
 
             pom.project {
@@ -137,5 +144,6 @@
 }
 
 signing {
+    required { project.has("release") && gradle.taskGraph.hasTask("uploadArchives") }
     sign configurations.archives
 }