title: How to compile Xtend sources, with the Standalone Compiler?
body: <p>This is my first question.</p>
  
  <p>I created the standalone compiler of <strong>Xtend</strong> with instructions below.</p>
  
  <ul>
  <li>Built with <strong>Ant</strong> and <strong>Ivy</strong></li>
  <li>Directories are: <strong>lib/</strong>, <strong>build/</strong></li>
  <li><strong>"xtend-compiler.jar"</strong> will be output on <strong>build/</strong></li>
  <li>Libraries are downloaded on <strong>lib/</strong></li>
  <li>the Jar-file contains dependent libraries</li>
  <li>Main-class is <strong>org.eclipse.xtend.core.compiler.batch.Main</strong></li>
  </ul>
  
  <p><strong>build.xml:</strong></p>
  
  <pre><code>&lt;project name="xtend-compiler" default="jar-run" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant"&gt;
    &lt;property name="lib.dir" value="lib" /&gt;
    &lt;property name="build.dir" value="build" /&gt;
  
    &lt;path id="lib.path.id"&gt;
      &lt;fileset dir="${lib.dir}"/&gt;
    &lt;/path&gt;
  
    &lt;!-- resolve --&gt;
    &lt;target name="resolve"&gt;
      &lt;mkdir dir="${lib.dir}"/&gt;
      &lt;ivy:retrieve pattern="${lib.dir}/[artifact].[ext]"/&gt;
    &lt;/target&gt;
  
    &lt;!-- jar --&gt;
    &lt;target name="jar"&gt;
      &lt;delete dir="${build.dir}"/&gt;
      &lt;copy file="${lib.dir}/org.eclipse.xtend.standalone.jar" tofile="${build.dir}/xtend-compiler.jar"/&gt;
      &lt;jar update="true" destfile="${build.dir}/xtend-compiler.jar"&gt;
        &lt;zipgroupfileset dir="${lib.dir}" includes="**/*.jar" excludes="org.eclipse.xtend.standalone.jar"/&gt;
        &lt;manifest&gt;
          &lt;attribute name="Main-Class" value="org.eclipse.xtend.core.compiler.batch.Main"/&gt;
        &lt;/manifest&gt;
      &lt;/jar&gt;
    &lt;/target&gt;
  
    &lt;!-- run --&gt;
    &lt;target name="run"&gt;
      &lt;java jar="${build.dir}/xtend-compiler.jar" fork="true"&gt;
      &lt;/java&gt;
    &lt;/target&gt;
  
    &lt;target name="jar-run" depends="jar,run"&gt;
    &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>ivy.xml:</strong></p>
  
  <pre><code>&lt;ivy-module version="2.0"&gt;
      &lt;info organisation="" module="xtend-compiler"/&gt;
  
      &lt;configurations&gt;
        &lt;conf name="web"/&gt;
      &lt;/configurations&gt;
  
      &lt;dependencies&gt;
        &lt;dependency org="org.eclipse.xtend" name="org.eclipse.xtend.standalone" rev="2.4.3" conf="web-&gt;default"/&gt;
      &lt;/dependencies&gt;
  &lt;/ivy-module&gt;
  </code></pre>
  
  <p><br></p>
  
  <hr>
  
  <p>After I built Jar-file, I tried to run</p>
  
  <pre><code>java -jar build/xtend-compiler.jar
  </code></pre>
  
  <p>this shows:</p>
  
  <pre><code>Usage: Main &lt;options&gt; &lt;source directories&gt;
  where possible options include:
  -d &lt;directory&gt;             Specify where to place generated xtend files
  -tp &lt;path&gt;                 Temp directory to hold generated stubs and classes
  -cp &lt;path&gt;                 Specify where to find user class files
  -encoding &lt;encoding&gt;       Specify character encoding used by source files
  -useCurrentClassLoader     Use current classloader as parent classloader
  </code></pre>
  
  <p>Then I want to compile <strong>HelloWorld.xtend</strong>:</p>
  
  <pre><code>class HelloWorld {
    def static void main(String[] args) {
      System.out.println("Hello World")
    }
  }
  </code></pre>
  
  <p>but I couldn't do that. For example:</p>
  
  <pre><code>java -jar build/xtend-compiler.jar HelloWorld.xtend
  
    Exception in thread "main" java.lang.NullPointerException
    at java.io.File.&lt;init&gt;(File.java:277)
    at org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler.configureWorkspace(XtendBatchCompiler.java:258)
    at org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler.compile(XtendBatchCompiler.java:273)
    at org.eclipse.xtend.core.compiler.batch.Main.main(Main.java:48)
  </code></pre>
  
  <p>The source files are in <strong>resource</strong> directory.</p>
  
  <p>How to compile it?</p>
  
  <h3>Supplement</h3>
  
  <p>I found a source of <strong>org.eclipse.xtend.core.compiler.batch.Main</strong>:</p>
  
  <p><a href="https://github.com/eclipse/xtext/blob/master/plugins/org.eclipse.xtend.core/src/org/eclipse/xtend/core/compiler/batch/Main.java" rel="nofollow">https://github.com/eclipse/xtext/blob/master/plugins/org.eclipse.xtend.core/src/org/eclipse/xtend/core/compiler/batch/Main.java</a></p>
  
  <p>I'm reading it, but now I don't understand what to add for arguments.</p>