Search code examples
javagenerated-codeacceleo

Using Acceleo 3 with Ant


I'm looking for information on how to perform Acceleo source generation with an Ant script. I've done some Googleing, but I haven't really found any straightforward way to do that. I'm looking first to do it in Eclipse, but a headless (is that the right word?) script would also be nice for semi-automatic builds.

Can anyone offer any help? Or are my expectations of what Acceleo can do unreasonable?


Solution

  • I believe all you need to do is to use a ant task to call your generation class. The generation class is the one generated along your mtl file that contains an "@main" annotation.

    Beware though, the generation will run in standalone mode, so don't use services that rely on eclipse API!

    The ant task should look like this:

    <java classname="your.generation.class.GenerateJava"
            classpathref="your.classpath.defined.in.ant">
        <arg value="your/input/model/example.uml"/>
        <arg value="your/target/folder" />
    </java>
    

    Hope this will help...