Acceleo 3.1, Maven and Tycho

Posted on in Blog

Among all the new features available in Acceleo 3.1, you will be able to find a new system to compile and build an Acceleo generator. You could already use the Eclipse system based on PDE already described here but now with Acceleo 3.1, you will have the opportunity to build your generator thanks Maven to with the introduction of a Tycho based build.

In order to build an Acceleo generator with Tycho, there are four steps to realize.

add a dependency to the parser generate the pom.xml files register the metamodel used by your generator and then launch the build

Now let’s have a look in details at those steps.

The first thing that you have to do is to add an optional dependency with the Acceleo parser in your MANIFEST.MF file.

Then, you can use the new action to generate the pom.xml files necessary to the build. This action can be found by right-clicking an Acceleo project in the “Configure” menu.

This action will generate two pom.xml files and a Java class. The first pom.xml file is located in your project and it contains all the necessary settings to build your project. The second pom.xml files is located in the folder containing you project (by default, the root of your workspace). This file contains all the settings for a Tycho-based build with the update sites for Eclipse Indigo and Acceleo.

The Java class generated will be used for the compilation of the Acceleo modules. This class is necessary in order to give you the opportunity to register your metamodel.

Prior to the launch, you should check that all the necessary source folders are in the build.properties file since it will be used to compute the files to build.

After that, you can type a simple “mvn clean package” in a terminal opened at the root of your Acceleo project and then witness the magic of Maven and Tycho.

It’s a bit long the first time you are launching it since Maven and Tycho will download half of the internet but once it’s done, behold the awesomeness of a Tycho based build of your Acceleo generator.

You can of course complete your Acceleo project by creating an Acceleo UI project and their matching feature and an update site in order to distribute easily your generator to your final customers. Thanks to the update site, they will be able to integrate your generator in their environment very easily.

You can find an example of this new build system in the open source UML to Java generator available on Github. For those who want to know more about Acceleo, you can follow me on twitter.