title: how to compile Spark in offline environment
body: <p>I have two machines that have installed the same OS (RedHat 6.5 64bit), but with different hardware configurations. Machine 1 (denoted as <code>M1</code>) has network access and Machine 2 (denoted as <code>M2</code>) doesn't have network access. <code>M2</code> has more powerful hardware (e.g., more CPU cores and more memory). Now I want to setup a <code>Spark</code> environment in the <code>M2</code>. </p>
  
  <p>I have downloaded the <code>spark-2.0.0-preview</code> from the official github repository. And I try to compile it, but it doesn't work because of no network access. After googling, I have found <a href="https://stackoverflow.com/questions/30493926/how-to-build-and-install-spark-in-an-offline-environment">this post</a>. So I turn to the <code>M1</code> to compile the <code>spark-2.0.0-preview</code> package. The compilation command is <code>./build/mvn -DskipTests clean package</code>. It shows <code>BUILD SUCCESS</code>. Then I copied the whole <code>spark-2.0.0-preview</code> directory and the <code>~/.m2/*</code> in <code>M1</code> into the corresponding positions in <code>M2</code>. </p>
  
  <p>In <code>M2</code>, I can run <code>./bin/run-example SparkPi</code>, which I think the built library in <code>M1</code> can also be run OK in <code>M2</code>. But when I run the command <code>./build/mvn -DskipTests clean package</code> to try to build the localization library in <code>M2</code>, it shows a error:</p>
  
  <pre><code>    [info] Error occurred during initialization of VM
      [info] java.lang.Error: Properties init: Could not determine current working directory.
      [info]  at java.lang.System.initProperties(Native Method)
      [info]  at java.lang.System.initializeSystemClass(System.java:1166)
      [info] 
      [error] Compile failed at May 19, 2016 1:43:09 AM [0.425s]
  </code></pre>
  
  <p>I realize that if the <code>clean</code> in the command leads to the problem. The <code>clean</code> means that <code>mvn</code> will delete the temporary files during the previous compilation. Thus I try another command <code>./build/mvn -DskipTests package</code>. But the error still exists. </p>
  
  <p>I have two questions:</p>
  
  <ol>
  <li>Will the built <code>spark-2.0.0-preview</code> library in <code>M1</code> be suitable in <code>M2</code>?</li>
  <li>Is there any compilation command that can keep all the temporary files when compiling the <code>Spark</code>? So we can simply copy all the files into another machine to reuse them. </li>
  </ol>