[EMF Generator] Headless Code Generation With Resource References Fails [message #1647210] |
Tue, 03 March 2015 05:02  |
Eclipse User |
|
|
|
Hi everybody,
I am successfully using the org.eclipse.emf.codegen.ecore.Generator headless application to generate source from Ecore models in a Maven build step using the tycho-eclipse-run plugin. However, as soon as my Ecore model refers to the Ecore Meta-Model itself, the headless application cannot resolve that reference. It tries to load the resource included in the GenModel from my workspace instead from the target platform. To me it seems that the Ecore Meta-Model is not correctly registered in the Ecore Registry when running the headless code generator application.
I created two sample projects attached as a ZIP-archive. One project does not refer to the Ecore Meta-Model and headless code generation works. The other one reflects the problem. Both projects include a codegen.bat file to run the headless code generator from a Windows command line. To make it work, one needs to set the environment variable ECLIPSE_HOME to his/her eclipse installation folder and adjust the launcher JAR name in the codegen.bat.
Does anyone have an idea how to fix this problem? How can I tell the headless code generator where to look for the included resource.
Thanks for any help and hints.
Cheers
Timo
|
|
|
|
|
Re: [EMF Generator] Headless Code Generation With Resource References Fails [message #1647769 is a reply to message #1647729] |
Tue, 03 March 2015 10:52  |
Eclipse User |
|
|
|
Timo,
Comments below.
On 03/03/2015 4:33 PM, Timo Rohrberg wrote:
> Hi,
>
> thank you for your comment. Do you think there's a way to integrate
> the PDE's target platform support into the Generator headless
> application? Or maybe there's a way to achive this with the
> tycho-target-platform plugin of Tycho?
Certainly if the PDE's bundles were deployed along with the application,
I'd expect it just to work, but I've never been an expert at how all
these tasks work; they're very limiting compared to what you can easily
to in the IDE...
>
> If the scenario does not work as presented, this means, one needs to
> version the sources generated from within the PDE in the SCM instead
> of having them regenerated within the headless Maven-Build.
Yes, and personally I think that's better, but I understand it's a bit
of a religious discussion and ties closely to how one feels about
modifying generated code:
http://ed-merks.blogspot.de/2008/10/hand-written-and-generated-code-never.html
> To me versioning generated sources is somehow ugly.
Yes and no. You certainly become much more aware of when things change
and why they're changing and of course there's no need to regenerate if
you haven't changed the model. It's also much easier to be sure you
reproduce and ship the expected results, which is especially important
if you must maintain older versions of software. Also, the project
source is complete as soon as you check it out from the SCM, without
needing generator tools installed and invoked them just to have
something that compiles...
>
> Any further comments, hints, suggestions?
Not so much. Sorry....
>
> Regards
> Timo
|
|
|
Powered by
FUDForum. Page generated in 0.38368 seconds