Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Accele0 3] Quick start/Getting started problem
[Accele0 3] Quick start/Getting started problem [message #870121] Sun, 06 May 2012 17:41 Go to next message
Joost Kraaijeveld is currently offline Joost KraaijeveldFriend
Messages: 273
Registered: July 2009
Senior Member
Hi,

I am trying to follow the Quick start/Getting started tutorials without
success.

The first assumes that one creates a UML model, which I did. But
whenever I choose the "Launch Acceleo Application" it shows a message
box saying:

"Selection does not contain a main type (@main annotation is missing in
your main template)",

which look correct as I do not have a main template or anything that
contains the string "main".

The second tutorial mentions at some point:

"You can now launch the generation of your Java beans using this
generation module but you need an ".uml" model as the input. You can
create one thanks to the wizards and editor provided by the UML project
or you can take the one provided in the UML to Java Acceleo example
(File -> New -> Example -> Acceleo -> UML to Java).

In order to do this, you will have to :

Right-click on the Acceleo module file (that is, the generate.mtl file)
and select Run As > Launch Acceleo Application."

This is confusing. Do I have to right click etc. to get a UML model, in
which case I get the same error message as in the Quick start tutorial.
Or do I first have to create a UML model by choosing (File -> New ->
Example -> Acceleo -> UML to Java)? In which case: this does not do
anything: no file is generated.

Am I missing something? It appears that the version of Acceleo that is
used in the tutorial is a different version than I use, based on the
screen shots (my version is 3.1.3c20120214-0359 according to the Eclipse
SDK Installation Details, plug-ins dialog) and several dialogs seem to
have many more options than are shown in the tutorial's screen shots.

Are there other, working, tutorials somewhere available?

TIA

Joost


Cheers,

Joost
Re: [Accele0 3] Quick start/Getting started problem [message #870684 is a reply to message #870121] Wed, 09 May 2012 10:49 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

Quote:

"Selection does not contain a main type (@main annotation is missing in
your main template)",

which look correct as I do not have a main template or anything that
contains the string "main".


Which is your problem, since the "main" template is the entry point of a generation. See http://wiki.eclipse.org/Acceleo/Getting_Started#Creating_a_main_module .

Quote:

This is a bit confusing. Do I have to "right-click on the Acceleo.." to
get a UML model, or do I first have to create a UML model by choosing
"File -> New -> Example -> Acceleo -> UML to Java" or by some other
means?


You have to first create the UML model through another tool. You can use "File -> New -> Example -> Acceleo -> UML to Java" to get a working full generator along with an example UML model. This action will create a new project in your workspace containing that sample model and the corresponding "UML to Java" generators. You can then either launch these generators or use the sample model with your own.

Quote:

Trying the second option "File -> New -> Example -> Acceleo -> UML to
Java" does not create any files at all.


This is not normal. It should import new projects in your workspace. In what version of Eclipse did you try, and do you have something in the error log (Window > Show View > Error Log)? Please post it here if you do.

If it helps, you can also retrieve sample generators from the improved UML-to-java example on github.

Laurent Goubet
Obeo
Re: [Accele0 3] Quick start/Getting started problem [message #870865 is a reply to message #870684] Thu, 10 May 2012 05:31 Go to previous messageGo to next message
Joost Kraaijeveld is currently offline Joost KraaijeveldFriend
Messages: 273
Registered: July 2009
Senior Member
Hi Laurent,

Thanks for answering. I did not get it working thought, although some
progress is made. See my comments below.


On 09/05/12 12:49, Laurent Goubet wrote:
> Which is your problem, since the "main" template is the entry point of a
> generation. See
> http://wiki.eclipse.org/Acceleo/Getting_Started#Creating_a_main_module .
Ah, I did not see that. Maybe because it is is introduced *after* the
part in the tutorial where I was supposed to generate the Java Beans.

The tutorial mentions to append "*/main*" at the end of the parent
fiels. If I do that it still does not work and a directory structure
with the strang names sample*/main*/ and the file umlToBeans.mtl is
created, and I cannot run it as Acceleo program. Moving the file to
sample/main (without the "*") solved the problem of the messasgebox.

It generated no code but the error log mentions:
"The generation fail to generate any file because there are no model
elements that matches at least the type of the first parameter of one of
your main templates.
The problem may be caused by a problem with the registration of your
metamodel, please see the method named "registerPackages" in the Java
launcher of your generator."

It may be a trivial problem, but as a very first time user of the tool I
do not have enough insight yet to understand it. I used the attached
Ecore model as the model. Should such an Ecore model work? And I thought
it contained a package?

>
> Quote:
>> This is a bit confusing. Do I have to "right-click on the Acceleo.." to
>> get a UML model, or do I first have to create a UML model by choosing
>> "File -> New -> Example -> Acceleo -> UML to Java" or by some other
>> means?
>
>
> You have to first create the UML model through another tool. You can use
> "File -> New -> Example -> Acceleo -> UML to Java" to get a working full
> generator along with an example UML model. This action will create a new
> project in your workspace containing that sample model and the
> corresponding "UML to Java" generators. You can then either launch these
> generators or use the sample model with your own.
This menu option does not generate anything. No new project or other
artefacts.

>
> Quote:
>> Trying the second option "File -> New -> Example -> Acceleo -> UML to
>> Java" does not create any files at all.
>
>
> This is not normal. It should import new projects in your workspace. In
> what version of Eclipse did you try,
I am following the tutorial using Eclipse 3.7.2 and the Acceleo SDK
3.1.3.v20120214-0359.

and do you have something in the
> error log (Window > Show View > Error Log)? Please post it here if you do.
>
> If it helps, you can also retrieve sample generators from the improved
> UML-to-java example on https://github.com/ObeoNetwork/UML-Java-Generation.

Ok, thanks. I will definitely look into that.


TIA

Joost


Cheers,

Joost
Re: [Accele0 3] Quick start/Getting started problem [message #871189 is a reply to message #870865] Fri, 11 May 2012 11:12 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Joost,

The getting started guide has been written at a time where any "new generation module" had a "main" by default. This is no longer the case, which is why you did not have one. There is one one the screenshot of the file we show at the end of the "new project" part... but we have to change the "wizard" screenshot to take into account the fact that one more checkbox needs to be ticked.

The Generate java beans part is missing the information about the "main" altogether. This needs to be fixed from our side. In the meantime, all you have to do is add
[comment @main/]
in between the "template" header and the "file" header so that it looks like this :

...
[template public generate(aClass : Class)]
[comment @main/]
[file (aClass.name.concat('.java'), false)]
...


Quote:

> This is not normal. It should import new projects in your workspace. In
> what version of Eclipse did you try,
I am following the tutorial using Eclipse 3.7.2 and the Acceleo SDK
3.1.3.v20120214-0359.


Please raise a bug on the bugzilla, this seems extremely strange.

Laurent Goubet
Obeo
Re: [Accele0 3] Quick start/Getting started problem [SOLVED] [message #871205 is a reply to message #871189] Fri, 11 May 2012 12:54 Go to previous messageGo to next message
Joost Kraaijeveld is currently offline Joost KraaijeveldFriend
Messages: 273
Registered: July 2009
Senior Member
Hi Laurent,

My problem is solved. As indicated by you in a separate mail, upgrading
to Acceleo 3.2 solved all my problems, including the generation of the
example UML model. Now I have nice Java classes with boats and cars.

Now my magic application and 2-mast schooner and Ferrari as instances of
my real world model ;-)

Joost


Cheers,

Joost
Re: [Accele0 3] Quick start/Getting started problem [SOLVED] [message #871355 is a reply to message #871205] Sat, 12 May 2012 10:16 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I'm pleased to be able to recommend Acceleo 3.3M7 after making less than
enthusiastic comments about all intervening versions from Acceleo 3.1.3
onward.

Regards

Ed Wilink


On 11/05/2012 13:54, Joost Kraaijeveld wrote:
> Hi Laurent,
>
> My problem is solved. As indicated by you in a separate mail,
> upgrading to Acceleo 3.2 solved all my problems, including the
> generation of the example UML model. Now I have nice Java classes with
> boats and cars.
>
> Now my magic application and 2-mast schooner and Ferrari as instances
> of my real world model ;-)
>
> Joost
Previous Topic:I've problems running an ATL M2T transformation from UML
Next Topic:[Acceleo]Can not launch generation twice
Goto Forum:
  


Current Time: Thu Apr 25 15:01:29 GMT 2024

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

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

Back to the top