Standalone Acceleo Generator

扶醉桌前 提交于 2019-12-22 05:30:07

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/5118377/standalone-acceleo-generator

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!