Download Options

Check the release notes.


 
Update Sites Use Update Manager in Eclipse
Latest Release
Latest Milestone
Bleeding Edge!
 
Full Eclipse Just Download and Unzip
OS X 64 Bit  32 Bit
Linux 64 Bit  32 Bit
Windows 64 Bit  32 Bit
 

Installation Instructions


 

The Xtend IDE integration requires Eclipse 3.5 or higher and a Java SDK 5 or higher. Use one of the udpate sites from above to install the full SDK into your running Eclipse. If you do not yet have an Eclipse on your machine, you can download one of the pre-packaged distributions on the right.

There are various options to compile Xtend sources. The most used way is using the Maven plug-in.

Install From Update Site

If you already have an Eclipse running you should install the "Xtend SDK"-Feature from one of the update sites listed above. To do so within Eclipse choose Help -> Install New Software.... In the upcoming dialog you should paste one of the update site URLS into the field named Work with. Now search for the feature Xtend SDK, select it and click Next and on the next page Finish.

Now the features are being downloaded and installed. Eclipse will ask you for a restart when downloading and installation is done.

Maven Plug-In

The runtime library as well as a plug-in to run the compiler in a Maven build can be be obtained from the Maven Central Repository: http://repo.maven.apache.org/maven2.

You can create a readily configured project using

mvn archetype:generate -DarchetypeGroupId=org.eclipse.xtend -DarchetypeArtifactId=xtend-archetype
						

If you already have a project with a pom.xml, you need to add the plugin configuration:

<plugin>
  <groupId>org.eclipse.xtend</groupId>
  <artifactId>xtend-maven-plugin</artifactId>
  <version>2.5.0</version>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
        <!-- <goal>testCompile</goal> -->
      </goals>
      <!-- By default the plugin will look for eclipse settings, and if non were found will generate to -->
      <!-- ${basedir}/src/main/generated-sources/xtend -->
      <!-- You can optionally configure a different target folder like so : -->
      <!--
      <configuration>
        <outputDirectory>${basedir}/src/main/xtend-gen</outputDirectory>
        <testOutputDirectory>${basedir}/src/test/xtend-gen</testOutputDirectory>
      </configuration>
      -->
    </execution>
  </executions>
</plugin>

As you see the outputDirectory can be specified to match the default of the Eclipse plug-in (xtend-gen). Of course you can also change the configuration in Eclipse to match the Maven default (generated-sources). To do so right-click on the project and select Properties or if you prefer a global setting choose Eclipse->Preferences. In the category Xtend/Compiler enter the directory name (see screenshot). It is interpreted as a relative path to the parent of the source folder, which includes the to-be-compiled Xtend file.

Configuring the compiler in Eclipse

Getting the runtime library via Maven

The runtime library is available from Maven Central, too: http://repo.maven.apache.org/maven2.

The XML for the dependency is :

<dependency>
  <groupId>org.eclipse.xtend</groupId>
  <artifactId>org.eclipse.xtend.lib</artifactId>
  <version>2.5.0</version>
</dependency>

Getting Started

When you've started Eclipse for the first time, you should see an empty workspace. Switch to the 'Java perspective' if you are not already in it. Xtend integrates with Java, so you need to create a Java project to get started. In the menu choose File -> New -> Java Project. In the upcoming dialog choose any project name you want (e.g. my.project). After clicking Finish Eclipse will create a fresh project with an empty source folder named '/src'.

A first class

To create your first Xtend class select the source folder and press the right mouse button. You should find the entry Xtend class in the category New >. If you don't see it you might not be in the Java perspective or you need to reset the perspective. To do so right click on the perspective icon on the top right and choose reset.

In the dialog you should give the class a name, for instance HelloWorld, and put it into some package (we chose my.namespace). Click Finish and an empty class will be created for you.

The missing lib

The newly created class will have an error marker, saying that you need to put the library on the classpath. There is a "quickfix" which does that for you. Put the cursor on the marked location and press CTRL+1 (or CMD+1 on a Mac) and select the option "Add Xtend libs to the classpath".

The library is also available from maven (see below) or as an OSGi bundle from the p2 update site above.

Have fun!

Now you are ready to code. Within the class body (between the curly braces) type main and press CTRL+space. An empty main method will be generated for you.

Now type in println('Hello World'), save and run the application. To do so use the green arrow and choose Run As -> Java Application.

Click here for the next steps and more examples.

 

@Xtendlang on Twitter