Merge pull request #49 from aozarov/master

ignore backend service when on MVN
diff --git a/java/pom.xml b/java/pom.xml
index 68d6a62..e83a275 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -33,6 +33,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
+        <version>2.6</version>
         <configuration>
           <archive>
             <manifest>
diff --git a/java/src/main/java/com/google/appengine/tools/pipeline/impl/model/JobRecord.java b/java/src/main/java/com/google/appengine/tools/pipeline/impl/model/JobRecord.java
index 4e8b919..3c56994 100755
--- a/java/src/main/java/com/google/appengine/tools/pipeline/impl/model/JobRecord.java
+++ b/java/src/main/java/com/google/appengine/tools/pipeline/impl/model/JobRecord.java
@@ -351,10 +351,8 @@
     if (queueSettings.getOnBackend() == null) {
       String module = queueSettings.getOnModule();
       if (module == null) {
-        BackendService backendSerivce = BackendServiceFactory.getBackendService();
-        String currentBackend = backendSerivce.getCurrentBackend();
-        // If currentBackend contains ':' it is actually a B type module (see b/12893879)
-        if (currentBackend != null && currentBackend.indexOf(':') == -1) {
+        String currentBackend = getCurrentBackend();
+        if (currentBackend != null) {
           queueSettings.setOnBackend(currentBackend);
         } else {
           ModulesService modulesService = ModulesServiceFactory.getModulesService();
@@ -372,6 +370,20 @@
     }
   }
 
+  private static String getCurrentBackend() {
+    if (Boolean.parseBoolean(System.getenv("GAE_VM"))) {
+      // MVM can't be a backend.
+      return null;
+    }
+    BackendService backendService = BackendServiceFactory.getBackendService();
+    String currentBackend = backendService.getCurrentBackend();
+    // If currentBackend contains ':' it is actually a B type module (see b/12893879)
+    if (currentBackend != null && currentBackend.indexOf(':') != -1) {
+      currentBackend = null;
+    }
+    return currentBackend;
+  }
+
   // Constructor for Root Jobs (called by {@link #createRootJobRecord}).
   private JobRecord(Key key, Job<?> jobInstance, JobSetting[] settings) {
     // Root Jobs have their rootJobKey the same as their keys and provide null for generatorKey