Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Generator] Headless Code Generation With Resource References Fails(Cannot generate sources with headless code generator from Ecore model with resource references.)
[EMF Generator] Headless Code Generation With Resource References Fails [message #1647210] Tue, 03 March 2015 10:02 Go to next message
Timo Rohrberg is currently offline Timo RohrbergFriend
Messages: 69
Registered: September 2011
Location: Karlsruhe
Member
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 #1647467 is a reply to message #1647210] Tue, 03 March 2015 12:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Timo,

Sorry but I think for such references to work the PDE's target platform
support must be available, or the Ecore project's source must be in the
runtime workspace.

On 03/03/2015 11:02 AM, Timo Rohrberg wrote:
> 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


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF Generator] Headless Code Generation With Resource References Fails [message #1647729 is a reply to message #1647467] Tue, 03 March 2015 15:33 Go to previous messageGo to next message
Timo Rohrberg is currently offline Timo RohrbergFriend
Messages: 69
Registered: September 2011
Location: Karlsruhe
Member
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?

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. To me versioning generated sources is somehow ugly.

Any further comments, hints, suggestions?

Regards
Timo
Re: [EMF Generator] Headless Code Generation With Resource References Fails [message #1647769 is a reply to message #1647729] Tue, 03 March 2015 15:52 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[Teneo] Using JPA with Teneo 2.1.0 causes IncompatibleClassChangeError
Next Topic:SVG rendering toolkit for the clips
Goto Forum:
  


Current Time: Thu Apr 18 19:51:23 GMT 2024

Powered by FUDForum. Page generated in 0.02925 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top