Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » JETEmitter failing to build with Custom Templates(Stuck on EMF 2.4.2)
JETEmitter failing to build with Custom Templates [message #651038] Thu, 27 January 2011 14:34 Go to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Hi,

I've started using templates and I have just started getting the intermittent bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=274868

I'm stuck on 2.4.2 at the moment (long story - but out of my control), please can anyone suggest a way that I can work around this (without hacking the EMF packages)?

To clarify, at the moment we do the generation using:

		Generator generator = new Generator();
		generator.setInput(genModel);
	        diagnostic = generator.generate(genModel,
                        GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE,
                        BasicMonitor
                                .toMonitor(new org.eclipse.core.runtime.NullProgressMonitor()));


Thanks

Rob

[Updated on: Fri, 28 January 2011 15:09]

Report message to a moderator

Re: JETEmitter failing to build with Custom Templates [message #651256 is a reply to message #651038] Fri, 28 January 2011 15:21 Go to previous messageGo to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
This one is driving me crazy, what I originally thought was the previously mentioned bug may not actually be that bug - just showing the same error.

The error I am getting is along the lines of:

Quote:
org.eclipse.emf.codegen.jet.JETException: ClassNotFoundException: org.eclipse.emf.codegen.ecore.templates.model.ValidatorClass _


I have been looking at this with the debugger and it appeas in JETEmitter.java (EclipseHelper.initialize) it appears to be generating each of the files:

.JETEmitters\src\org\eclipse\emf\codegen\ecore\templates\model\ValidatorClass_.java


Which seems to be working, and then tries to build them, this is where the problem occurs, it seems to assume that they are built immediately, however this is not the case, it is as if they have been put onto a queue to wait to be built. Then later in the code:

          Class<?> theClass = 
            theClassLoader.loadClass
              ((packageName.length() == 0 ? "" : packageName + ".") + jetCompiler.getSkeleton().getClassName());


The attempt to load the classes fail, as they haven't been built yet. This means everything fails - then after the failure, they seem to suddenly build:

.JETEmitters\bin\org\eclipse\emf\codegen\ecore\templates\model\ValidatorClass_.class


It may be worth noting that I have auto-build on, and the call to request the building of the EMF project using the templates is being made from a seperate project that has been kicked off by an auto-build itself.

What are peoples thoughts on the fact that the class files are not being generated due to them being put on the back of the build queue which will not be processed until the "current build" operation is completed?

Any suggestions would be great!, Thanks, Rob
Re: JETEmitter failing to build with Custom Templates [message #651368 is a reply to message #651256] Sun, 30 January 2011 00:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30545
Registered: July 2009
Senior Member
Rob,

You're trying to generate during the middle of an on-going auto build?


Rob wrote:
> This one is driving me crazy, what I originally thought was the
> previously mentioned bug may not actually be that bug - just showing
> the same error.
>
> The error I am getting is along the lines of:
>
> Quote:
>> org.eclipse.emf.codegen.jet.JETException: ClassNotFoundException:
>> org.eclipse.emf.codegen.ecore.templates.model.ValidatorClass _
>
>
> I have been looking at this with the debugger and it appeas in
> JETEmitter.java (EclipseHelper.initialize) it appears to be generating
> each of the files:
>
> JETEmitters\src\org\eclipse\emf\codegen\ecore\templates\mode l\ValidatorClass_.java
>
>
> Which seems to be working, and then tries to build them, this is where
> the problem occurs, it seems to assume that they are built
> immediately, however this is not the case, it is as if they have been
> put onto a queue to wait to be built. Then later in the code:
>
> Class<?> theClass = theClassLoader.loadClass
> ((packageName.length() == 0 ? "" : packageName + ".") +
> jetCompiler.getSkeleton().getClassName());
>
>
> The attempt to load the classes fail, as they haven't been built yet.
> This means everything fails - then after the failure, they seem to
> suddenly build:
>
> JETEmitters\bin\org\eclipse\emf\codegen\ecore\templates\mode l\ValidatorClass_.class
>
>
> It may be worth noting that I have auto-build on, and the call to
> request the building of the EMF project using the templates is being
> made from a seperate project that has been kicked off by an auto-build
> itself.
>
> What are peoples thoughts on the fact that the class files are not
> being generated due to them being put on the back of the build queue
> which will not be processed until the "current build" operation is
> completed?
>
> Any suggestions would be great!, Thanks, Rob
>
Re: JETEmitter failing to build with Custom Templates [message #651379 is a reply to message #651038] Sun, 30 January 2011 06:07 Go to previous messageGo to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Hi Ed,

Yes, The auto-build has kicked off one eclipse project, in that project part of it's build is to run some code which generates the model and associated code.

This has been working fine, until we added custom templates.

Thanks

Rob

[Updated on: Sun, 30 January 2011 06:09]

Report message to a moderator

Re: JETEmitter failing to build with Custom Templates [message #651419 is a reply to message #651379] Sun, 30 January 2011 17:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30545
Registered: July 2009
Senior Member
Rob,

I don't know how to force a build to complete while another build is
running. If you look at some of the recent threads, there was one where
the extended templates are compiled and deployed in the IDE so that
pre-compiled .class file versions of the templates are used; it involves
putting platform:/plugin/<bundle-id> for the bundle with the precompiled
templates on the template path...


Rob wrote:
> Hi Ed,
>
> Yes, The auto-build has kicked off one eclipse project, in that
> project part of it's build is to run some code which generates the
> model and associated code.
>
> Thanks
>
> Rob
>
Re: JETEmitter failing to build with Custom Templates [message #651561 is a reply to message #651038] Mon, 31 January 2011 16:24 Go to previous messageGo to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Thanks Ed,

I had had a hunt around and the only think I managed to find was:

http://www.eclipse.org/forums/index.php?t=msg&th=152145

Which is pretty old - is this the post you were referencing?

Thanks, Rob
Re: JETEmitter failing to build with Custom Templates [message #651583 is a reply to message #651561] Mon, 31 January 2011 17:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30545
Registered: July 2009
Senior Member
It's part of this thread:
http://www.eclipse.org/forums/index.php?t=msg&goto=64795 7&S=764d7d3fa998617b37fa587fbcf48d97

Rob wrote:
> Thanks Ed,
>
> I had had a hunt around and the only think I managed to find was:
>
> http://www.eclipse.org/forums/index.php?t=msg&th=152145
>
> Which is pretty old - is this the post you were referencing?
>
> Thanks, Rob
Re: JETEmitter failing to build with Custom Templates [message #651969 is a reply to message #651038] Wed, 02 February 2011 10:15 Go to previous messageGo to next message
Rob Mising name is currently offline Rob Mising nameFriend
Messages: 118
Registered: July 2010
Senior Member
Thanks for your help Ed,

I have now managed to get it working by having a new separate project that contains the pre-compiled templates and them reference them from the GenModel with "platform:/resource/..."

Do you think that this concurrent build problem for templates will be a permanent restriction? Or is there a chance it will be resolved in a later release?

Thanks, Rob
Re: JETEmitter failing to build with Custom Templates [message #651985 is a reply to message #651969] Wed, 02 February 2011 10:41 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30545
Registered: July 2009
Senior Member
Rob,

I doubt I'd find time and no one else is likely to look into it...


Rob wrote:
> Thanks for your help Ed,
>
> I have now managed to get it working by having a new separate project
> that contains the pre-compiled templates and them reference them from
> the GenModel with "platform:/resource/..."
>
> Do you think that this concurrent build problem for templates will be
> a permanent restriction? Or is there a chance it will be resolved in a
> later release?
>
> Thanks, Rob
>
Previous Topic:cdo builds on twitter (@cdobuilds), not anymore?
Next Topic:OCL with java date attributes?
Goto Forum:
  


Current Time: Wed Oct 16 04:20:37 GMT 2019

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

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

Back to the top