Maven integration in Acceleo

Posted on in Blog

With the release of the new Acceleo stand alone front end for the compilation of Acceleo modules, I’ve started to work on a brand new maven integration in Acceleo.

Currently in Acceleo, if you need to build Acceleo modules with maven you have to use a Tycho based build with a java class generated by Acceleo to tweak the build (for example to register the metamodel(s) used in the modules). This Tycho based build will always produce an Eclipse plugin as a result.

The next major release of Acceleo will have a maven plugin dedicated to the compilation and it will bring several key improvements. Firstly, the new compilation front end brings a completely stand alone compilation. Those who want to build their Acceleo modules without having to build an Eclipse plugin will be able to do so. Secondly, this new front end support more complex project structures (with for example, multiple output folders in a same project). Thirdly, you will have the ability to contribute a class to influence the uris of the dependencies in the saved files (for example, change all the uris of the dependencies to other module to “platform:/plugins” uris that are more “eclipse plugin” friendly). Finally, it also features an improved resolution of the dependencies of a project with several options.

Your project will be able to have a dependency to Acceleo modules in another project (that should have been previously compiled). A valid Acceleo project is just a directory on the file system with at least one “source” sub-directory and one “output” sub-directory (no need of an Eclipse nature or anything like that).

This first solution is fine as long as you have the source code of the other modules but sometime you need to build something with the dependencies in jars. The maven plugin for Acceleo will let you declare a dependency to a jar containing already compiled Acceleo modules by using:

The absolute path of the jar. Ex: C:\…\myJar.jar The path of the jar relative to the project built. Ex: ${project.basedir}\lib\myJar.jar The groupId and the artifactId of the jar resolved by maven  (the version of the jar is optional since some version number includes the date of the build and therefore change often). Ex: myGroupId:myJar:myVersion The name of an Eclipse bundle resolved by Tycho preceding by “p2.eclipse-plugin” only in a Tycho based build (“p2.eclipse-plugin” is the groupId of all the dependencies resolved by Tycho). Just like the previous use case, the version of the jar is optional too. Ex: p2.eclipse-plugin:myJar:myVersion

For those who want to have a look at this new maven based build for Acceleo, you can find its source code on github.com and you can test it with a simple pom.xml like this one.