Upgrades appengine dependencies to 1.9.42 and Uploader
to the new remote authentication api.
Use `gcloud init` (or `gcloud auth login`) instead of
save_credentials.sh.

Change-Id: Icab2093202b095a5cdd113ddc0c47cc221407d9e
diff --git a/pom.xml b/pom.xml
index e664f87..98f2a59 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,6 +6,10 @@
   <artifactId>uploader</artifactId>
   <version>1.0-SNAPSHOT</version>
 
+  <properties>
+    <appengine.target.version>1.9.42</appengine.target.version>
+  </properties>
+
   <dependencies>
     <dependency>
       <groupId>com.google.gwt.site</groupId>
@@ -22,17 +26,17 @@
     <dependency>
       <groupId>com.google.appengine</groupId>
       <artifactId>appengine-api-1.0-sdk</artifactId>
-      <version>1.7.6</version>
+      <version>${appengine.target.version}</version>
     </dependency>
     <dependency>
       <groupId>com.google.appengine</groupId>
       <artifactId>appengine-tools-sdk</artifactId>
-      <version>1.7.6</version>
+      <version>${appengine.target.version}</version>
     </dependency>
     <dependency>
       <groupId>com.google.appengine</groupId>
       <artifactId>appengine-remote-api</artifactId>
-      <version>1.6.1</version>
+      <version>${appengine.target.version}</version>
     </dependency>
     <dependency>
       <groupId>commons-codec</groupId>
diff --git a/src/main/java/com/google/gwt/site/uploader/Uploader.java b/src/main/java/com/google/gwt/site/uploader/Uploader.java
index 9bfedf1..a08ae88 100644
--- a/src/main/java/com/google/gwt/site/uploader/Uploader.java
+++ b/src/main/java/com/google/gwt/site/uploader/Uploader.java
@@ -53,13 +53,16 @@
     uploadController.uploadOutdatedFiles();
   }
 
-  private static RemoteApiOptions loadCredentials(String fileOrLocalhost) throws IOException {
-    if (fileOrLocalhost.equals("localhost")) {
-      // special case for dev server
-      return new RemoteApiOptions().server("localhost", 8080).credentials("nobody@google.com", "ignored");
+  private static RemoteApiOptions loadCredentials(String appIdOrLocalhost) throws IOException {
+    if (appIdOrLocalhost.equals("localhost")) {
+        // special case for dev server
+        return new RemoteApiOptions()
+                .server("localhost", 8080).useDevelopmentServerCredential();
     } else {
-      logger.info("credentials file: '" + fileOrLocalhost + "'");
-      return new CredentialsProvider().readCredentialsFromFile(fileOrLocalhost);
+        logger.info("authenticating to: '" + appIdOrLocalhost + "'");
+        return new RemoteApiOptions()
+                .server( appIdOrLocalhost + ".appspot.com", 443)
+                .useApplicationDefaultCredential();
     }
   }
 }