Standalone Acceleo Generator
Asked Answered
M

1

7

I need to develope a standalone Acceleo generator but I don't know hot to start. I've done my generator inside my Acceleo Project. The Acceleo Project contains the generate.mtl file, the Generate.java file, and the Activator.java file.

What I have to do?

Minardi answered 25/2, 2011 at 14:27 Comment(2)
Could you give more details, It's a little bit obscure...Checkpoint
Why do you need to develop the generator? You mean the code that will convert from your model to Java code?Checkpoint
R
3

Acceleo has been designed with standalone generation in mind right from the start. The Generate.java file is there for that reason. If you need to launch the generation in standalone, simply use its main or instantiate with the two needed parameters (target folder and input model) and use its doGenerate(...) method:

URI modelURI = URI.createFileURI("c:\my\model.ecore");
File targetFolder = new File("c:\generate\here");
Generate generator = new Generate(modelURI, targetFolder, Collections.emptyList());
generator.doGenerate();

Take note that when in standalone, you have to do by hand a lot of work that Eclipse usually does for you. Most notably, you'll have to register the ecore packages of your metamodels. See the example of the UML metamodel registration.

See also the Acceleo wiki FAQ entries about standalone generation and compilation

Ruthie answered 28/2, 2011 at 8:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.