Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Beginner needs a helping hand either on jet or acceleo to process ecore model(got stuck between all the samples that don't work)
Beginner needs a helping hand either on jet or acceleo to process ecore model [message #756142] Fri, 11 November 2011 03:43 Go to next message
Geronimo M.H. is currently offline Geronimo M.H.
Messages: 7
Registered: October 2011
Junior Member
Hello,

I'd like to extend the generation result of ecore models like adding a new plugin.
As code generation with eclipse was a new item for me, I tried jet tutorials, as well as acceleo tutorials.

With both, the trivial (non ecore models) work, but as soon as I try to process ecore models, I'm stuck.

I read the redbook for jet, trying to follow those advices with cloning the original templates and changing them - but as soon as I create my own template, I get the error, that "argument" is not a valid/known token. - Frustrating, as the original template uses "argument" and it works ...
So I don't know, how to pass information/arguments into template processing...

I made similar experiences with acceleo.
When I follow the online help from eclipse (or any of the availabel tutorials), after creating a new project with sample code, nothing will be generated.
So I debugged into generation processing and found out, that the sample template is thrown away, as it is not recognized as "main" template.

Don't know - which technology should I use for serious long term projects?
Of cause, acceleo looks nice, has color support, but does it serve to process ecore models?
There are so many dead/abandoned (eclipse-)projects with quite attractive propaganda ...
... so I'm really confused.


Is there any working sample available, that shows, how to extend the code-generation of ecore models?
There is so much outdated and for so invalid documentation around, that I did not find the right way.


Any hint is appreciated.

kind regards

Gero



Re: Beginner needs a helping hand either on jet or acceleo to process ecore model [message #756333 is a reply to message #756142] Sat, 12 November 2011 01:36 Go to previous messageGo to next message
Geronimo M.H. is currently offline Geronimo M.H.
Messages: 7
Registered: October 2011
Junior Member
Hello,

I gave acceleo a new try and I guess, I found the major gotchas:

- if deselecting "use default location" on project creation wizzard, the generated (ant)scripts can't work. So from my point of view, this should be fixed or the option should be disabled.

- as recommended in the comment of generateTarget.xml I copied the file to an empty target project. But as usual for ant build scripts, I placed that file in the projects root directory - so the relative paths in generate.xml won't work.

- the plugin eclipse.core.resources has been forgotten to add to the generated MANIFEST.MF (from project creation wizzard) as well as to the classpath in generated.xml - Exception "class not found" for IWorkspaceRoot (for cleanup after generation)

- it is very nice, that on saving the MANIFEST.MF the generated.xml will be rewritten. Bad, if some settings had been manually adapted in that file. I think, a warning should be added as initial comment, or as usual with ant scripts, create a description that contains that warning.


You might say, that my expectations are wrong, but my expectations depend on the major release number of a project.
... and with major release number of above zero I expect that all wizzards have been tested in all offered variants and that the generated output is working out of the box!
And what I expect most from projects with a major release of 3 or above - that all provided documentation matches the behaviour of current codebase!


To support non standard locations from ant scripts I recommend to split model and target path into a "projects base directory" (probabely as absolute path) and relative locations for model and target directory. It might be better, place that properties in generateTarget.xml and not in generate.xml
Where as ... I think, it would be better to declare a target workspace root, so that several projects could be generated. Don't know, whether it is possible to create projects from scratch by generator, but I would expect such capabilities Wink


kind regards

Gero
Re: Beginner needs a helping hand either on jet or acceleo to process ecore model [message #756824 is a reply to message #756333] Tue, 15 November 2011 04:53 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1625
Registered: July 2009
Senior Member
Hi,

First of all, which version of Acceleo are you using? With 3.2, you shouldn't have had "nothing generated" without a warning in the error log. What is this warning?

My guess is that you haven't specified "Ecore" as the metamodel on which your template works (the url at the top of the file, in the module declaration). It should be something like :

[module myModule('http://www.eclipse.org/emf/2002/Ecore')/]


And your templates should operate on one of the EMF elements : EPackage, EClass... something like :

[template public aTemplate(class : EClass)/]


The EEF team has started rewriting the jet templates used by the EMF Compare (for "model", "edit" and "editor" generation from a genmodel) in Acceleo; you can find the current state of this endeavour on their CVS :

host : dev.eclipse.org
cvsroot : /cvsroot/modeling
path : org.eclipse.emf/org.eclipse.emf.eef/plugins/org.eclipse.emf.eef.codegen.ecore


That's for the answer I think suit your needs ... but for individual answers :

Quote:
the sample template is thrown away, as it is not recognized as "main" template.

Either
a) you don't have the "[comment @main/]" annotation in the template, or
b) your template's arguments do not match any of the input model's elements (template on "EClass" with an empty model, template of "uml::Class" with an ecore model...).

Quote:
Don't know - which technology should I use for serious long term projects?
Of cause, acceleo looks nice, has color support, but does it serve to process ecore models?
There are so many dead/abandoned (eclipse-)projects with quite attractive propaganda ...
... so I'm really confused.


I am part of the Acceleo dev team, so I'll obviously answer Acceleo Wink. Jet is an old technology with little to no tooling, and which is not really maintained : the only activity on Jet this year was to fix the build. You can look at the development activity of both projects :
a) Acceleo : http://www.eclipse.org/projects/project.php?id=modeling.m2t.acceleo
b) Jet : http://www.eclipse.org/projects/project.php?id=modeling.m2t.jet

If you need long-term support, don't go for Jet. And no, Acceleo is not dead, far from it Smile.

Acceleo can process ecore models : it can process just about anything that can be loaded as a model by EMF.

Quote:
Is there any working sample available, that shows, how to extend the code-generation of ecore models?


Take a look at what EEF did for a sample of Ecore generation.

Quote:
the generated (ant)scripts can't work


The ant scripts have not really been maintained since they were first written and, granted, they are not "noob-friendly" Razz. Please look at the Acceleo tutorials and documentation and write starting templates; then, when you have something that works, we provide more important support for standalone usage through either maven or direct java calls, but you'll have time to see that coming and will probably understand their use once you are more familiar with Acceleo (see also St├ęphane's blog on the subject).

Quote:
But as usual for ant build scripts, I placed that file in the projects root directory - so the relative paths in generate.xml won't work.


We are not that familiar with ant and what is "usual" with it. Please raise bugs on the eclipse bugzilla if you think there are things we should fix on that subject.

Quote:
the plugin eclipse.core.resources has been forgotten to add to the generated MANIFEST.MF


I don't remember observing this behavior before, we'll have to look into it. Could you raise a bug corresponding to this issue?

Quote:
it is very nice, that on saving the MANIFEST.MF the generated.xml will be rewritten.


IIRC, this is also a file that should be moved to another location lest we overwrite it. Please refer to what I mentionned above : ant is not really the mean to launch an Acceleo generation from Eclipse, and there is more advanced support for bundled generators.

Quote:
that all provided documentation matches the behaviour of current codebase!


That should be the case, though do not hesitate to raise any issues on that aspect too.

Laurent Goubet
Obeo
Re: Beginner needs a helping hand either on jet or acceleo to process ecore model [message #757316 is a reply to message #756824] Thu, 17 November 2011 11:30 Go to previous messageGo to next message
Geronimo M.H. is currently offline Geronimo M.H.
Messages: 7
Registered: October 2011
Junior Member
Hi,

thank you for spending your time for such a huge reply.

Quote:
First of all, which version of Acceleo are you using?

I use indigo SR1 and for so not 3.2

All I wrote is about the indigo packages.

The last 2-3 weeks I spent looking at the different eclipse projects, that from their propaganda sounded usable for enterprise environments to me.
But after all - and don't take me wrong: I don't wonna miss eclipse as an ide - but using eclipse as a framework is a big fart.
Propaganda sounds good, but when u start to use the projects, you'll get fucked.

There was only one outstanding project, that was as professional as expected, working out of the box and being well documentated: Eclipselink! Well done!
The rest was not worth the time spended looking at it.
Same is true for most blogs around eclipse. I found only one blog, outstanding and worth to come back and read several times.
Mr. Lars Vogel - u did a very appreciated, good job!

but back to acceleo:
You can take for granted, that I read anything available even diving into the code.
What I did NOT - and never will do is register to an unknown site for reading documentations. NO! Never!
Before that - I go for commercial frameworks.

I have a rule of thumb:
If I get in touch with something new (respect to software development), I spent a day getting into it. If after that day I have a working sample, that can be customized, I dive deeper ...
if not - I'll kick it to /dev/null and look for alternatives or do the job myself.

Respect to acceleo I spent more than one day, cause the propaganda was really attractive - but after all I have to resume, that the value of acceleo respect to code generation is nothing. Zero. Its just a nice colored editor, but not a generator.

From a generator I expect at least the ability to generate pojos out of the box. Of cause with overwrite and generation blocker support - like what's offered by "emf codegen".

May be, I did not get rid of all, but if I got things right, I have to code all generation with the mof language. There's nothing I can start with and the features are not documented at all (yes, I read the mof specs from omg - there are some useful samples, but that's no documentation for the features)
I refer to things like [file], overloading of templates, good practices on writing templates, ...

So if I have to do all by myself but with mof templates, why should I use acceleo?

Many bigger companies have their own frameworks, that must be used, so I'm not interested in editor-generation-templates. They will never fit the customers requirements.

A rock solid generator for pojos, that could easily be customized (output and workflow) is worth hundreds of editor generations ...

just my oppinion!

Gero
Re: Beginner needs a helping hand either on jet or acceleo to process ecore model [message #757394 is a reply to message #757316] Fri, 18 November 2011 03:45 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1625
Registered: July 2009
Senior Member
Geronimo,

You are evaluating open-source softwares, using their free support channels, and their free documentation. If there are things you do not like about those, the bugzilla is also free : please raise the bugs/enhancement request against these project. Constructive feedback are very welcome as they allow us to enhance our tools; but "it does not work" thrown on a forum will not help us (neither will it help you).

Acceleo is used by professionals in enterprise setups, it is also used by individuals, university students, researchers... Why does it not cut it for you? That is the feedback we seek.

You may not want to register on an unknown site for documentation; that is a standpoint I understand. We also provide documentation with public unregistered access on the project's wiki; though less complete. Most of the documentation is also included directly within Eclipse within the "Help > Help Content" menu; and examples of how to use the project are available within "File > New > Example...".

Laurent Goubet
Obeo
Re: Beginner needs a helping hand either on jet or acceleo to process ecore model [message #757624 is a reply to message #757394] Sun, 20 November 2011 10:18 Go to previous message
Geronimo M.H. is currently offline Geronimo M.H.
Messages: 7
Registered: October 2011
Junior Member
Quote:
You are evaluating open-source softwares, using their free support channels, and their free documentation.

Yep - that's why I'm writing.
I could have kept my mouth shut, but I think, the direction of most (?) eclipse projects is completely wrong.

I'm no java beginner and I made really good experiences with open source stuff and open source developers. Especially with those, that dedicate their spare time to open source development. The most outstanding piece of java code, I ever got in touch with: glazedlists - and the developers are very fast and helpful on their support.

May be I'm wrong, but with eclipse it looks to me, as if most (?) contributers are professional software developers that get paid for their job.
So my judgement of the sources is quite different to those, that spend their spare time.

What drives me mad is the so called "open source" from companies, that wonny make money with training and support for their provided sources. My experience is, that sources from those companies are more than a thrown out puzzle - some nice pieses, lot of ugly stuff, but never complete. Almoust always is a piece missing.

So from my point of view, the state of source is not a lack of feedback, but intention of originating companies.

I.e. when I actually wrote my prototype, I discovered some nice code, that could set standards for rcp development, but the code is hidden in internal (pde) packages and made unusable with discouraged access modifiers. When I looked at the sources, I discouvered lot of work dedictated on obfuscation and code protection.
That's not really open source!

... or with acceleo:
you (not personally) published a uml2java tutorial, which is quite useful to read, but eclipse does not provide any tool to create uml files. Eclipse model standard is ecore and genmodel, but acceleo does not provide tutorials or basic templates for those.

When I read the "wishlist" of acceleo - it looks to me, that there's no will to change situation. So why should I create duplicate bugzilla entries?

May be, acceleo will usable, if I buy a product from obeo?
But its definitely not, if one tries to use the published sources from eclipse only.

To close this frustrating thread:
The time I spent to find out, that acceleo does not help on code generation tasks, was the same time, I needed to write a generator that fits my needs. So trying to use eclipse projects was just wasting time ...

So for me - if you look a bit closer at eclipse projects and their usability, most projects seem to cry out: please don't use me - do the job on your own.
That's very poor for an open source community - well, at least from my point of view.

regards
Gero
Re: Beginner needs a helping hand either on jet or acceleo to process ecore model [message #757872 is a reply to message #757316] Thu, 17 November 2011 12:25 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4032
Registered: July 2009
Senior Member
Hi
>
> The last 2-3 weeks I spent looking at the different eclipse projects,
> that from their propaganda sounded usable for enterprise environments
> to me.
> But after all - and don't take me wrong: I don't wonna miss eclipse as
> an ide - but using eclipse as a framework is a big fart.
> Propaganda sounds good, but when u start to use the projects, you'll
> get fucked.
>
Well you should have tried three years ago. Things are vastly improved.
> There was only one outstanding project, that was as professional as
> expected, working out of the box and being well documentated:
> Eclipselink! Well done!
You clearly haven't tried Xtext which has excellent tutorials pitched at
different levels of patience.
Many other projects have tutorials that are not perfect, but are still
very useable.

Eclipse is an Open Source Community. I suggest that you raise a
suggestion Bugzilla against each project that you found unsatisfactory
with constructive suggestions as to how things could be improved.
> The rest was not worth the time spended looking at it.
> Same is true for most blogs around eclipse. I found only one blog,
> outstanding and worth to come back and read several times. Mr. Lars
> Vogel - u did a very appreciated, good job!
>
> but back to acceleo:
> You can take for granted, that I read anything available even diving
> into the code.
> What I did NOT - and never will do is register to an unknown site for
> reading documentations. NO! Never!
I sympathize with that view; I too refused to visit the site until some
overpowering reference required it.

However there is plenty of documentation under Help->Contents so I'm not
clear why you didn't read it.
> Before that - I go for commercial frameworks.
>
Good luck. I'm sure you will find very helpful people on their
newsgroups and be able to examine the code when your confused.
> I have a rule of thumb: If I get in touch with something new (respect
> to software development), I spent a day getting into it. If after that
> day I have a working sample, that can be customized, I dive deeper ...
> if not - I'll kick it to /dev/null and look for alternatives or do the
> job myself.
My rule is closer to 5 minutes to see something interesting.
> Respect to acceleo I spent more than one day, cause the propaganda was
> really attractive - but after all I have to resume, that the value of
> acceleo respect to code generation is nothing. Zero. Its just a nice
> colored editor, but not a generator.
Your expectation is clearly adrift. Acceleo is a model to text
transformation engine and as such it can be configired for a wide
variety of code generation problems. Code is not unequivocably equal to
Java. Acceleo is an excellent generator that amongst other things I use
to translate OCL to Java. But the Java is in my favourite style using
dispatch tables. You cannot just generate POJOs. Firstly who wants just
POJOs? Secondly what is your 'standard' input format. If you really want
POJOs then use EMF's genmodel. If you just want Java then elaborate
Ecore using Xcore/Xbase or OCLinEcore. Acceleo is for interesting problems.
>
> So if I have to do all by myself but with mof templates, why should I
> use acceleo?
>
You certainly don't have to use MOF templates. I'm not sure what they
are. I've never used one.

As I noted above, if you want boring Java, use a boring tool.
> Many bigger companies have their own frameworks, that must be used, so
> I'm not interested in editor-generation-templates. They will never fit
> the customers requirements.
You seem very confused. What has editor-generation got to do with POJOs.

Regards

Ed Willink
Previous Topic:[Acceleo] .mtl or .emtl?
Next Topic:[Acceleo] dynamic vs generated package used by Acceleo Plug-in Application
Goto Forum:
  


Current Time: Wed Aug 27 09:16:16 EDT 2014

Powered by FUDForum. Page generated in 0.02008 seconds