YARN-6336. Jenkins report YARN new UI build failure. Contributed by Sunil G.

(cherry picked from commit bb6a214cd34b9c87b0ba68205c680024ad294587)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
index 1eb9b65..e221e7e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml
@@ -31,7 +31,7 @@
   <properties>
     <packaging.type>pom</packaging.type>
     <webappTgtDir>${basedir}/target/src/main/webapp</webappTgtDir>
-    <node.executable>node</node.executable>
+    <node.executable>${basedir}/target/src/main/webapp/node/node</node.executable>
     <nodeVersion>v4.4.5</nodeVersion>
     <npmVersion>2.15.5</npmVersion>
     <keep-ui-build-cache>false</keep-ui-build-cache>
@@ -169,12 +169,11 @@
                 </goals>
                 <configuration>
                   <workingDirectory>${webappTgtDir}</workingDirectory>
-                  <executable>ember</executable>
+                  <executable>${node.executable}</executable>
                   <arguments>
-                    <argument>build</argument>
-                    <argument>-prod</argument>
-                    <argument>--output-path</argument>
-                    <argument>${basedir}/target/dist</argument>
+                    <argument>node/npm/bin/npm-cli</argument>
+                    <argument>run</argument>
+                    <argument>build:mvn</argument>
                   </arguments>
                 </configuration>
               </execution>
@@ -187,7 +186,7 @@
             <artifactId>maven-war-plugin</artifactId>
             <configuration>
               <webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
-              <warSourceDirectory>${basedir}/target/dist</warSourceDirectory>
+              <warSourceDirectory>${webappTgtDir}/dist</warSourceDirectory>
             </configuration>
           </plugin>
 
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
index 573e505..105dad3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json
@@ -8,8 +8,10 @@
     "test": "tests"
   },
   "scripts": {
-    "build": "ember build",
-    "start": "ember server"
+    "build": "TMPDIR=tmp node ./node_modules/ember-cli/bin/ember build",
+    "start": "TMPDIR=tmp node ./node_modules/ember-cli/bin/ember server",
+
+    "build:mvn": "TMPDIR=tmp node/node ./node_modules/ember-cli/bin/ember build -prod"
   },
   "repository": "",
   "engines": {