Home » Modeling » M2T (model-to-text transformation) » [Acceleo 3.1] Metamodel loading issues(Metamodel loads one time in two)
[Acceleo 3.1] Metamodel loading issues [message #725571] |
Thu, 15 September 2011 04:50  |
Eclipse User |
|
|
|
Hi,
I am facing metamodel loading issues within Eclipse Indigo.
I have an Acceleo project which uses a homemade metamodel.
Scenario 1 :
- I run a second Eclipse instance, with my metamodel and my acceleo project deployed as plugins in it. The generation works fine.
Scenario 2 :
- I make an update-site out of my projects, and install those plugins in a brand new fresh Indigo. I get this error :
Quote:
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 seems that in the second scenario, Acceleo won't load correctly my metamodel. It is weird, since :
- The plugins loaded in the scenario 1 are the same as the ones I put on the update-site (scenario 2).
- My Xtext editor succeed in both scenarios to open a file from my metamodel, and edit it (impossible if the metamodel is not correctly deployed in Eclipse).
I do not understand the problem, and would appreciate any help 
Thanks,
Simon.
|
|
| | | |
Re: [Acceleo 3.1] Metamodel loading issues [message #727005 is a reply to message #725571] |
Tue, 20 September 2011 03:21   |
Eclipse User |
|
|
|
Hi,
In the scenario (1) in which I use a second instance, the generation works fine.
The problem is when I want to install my plugins through an update-site into a fresh install of Eclipse. Moreover, I launch my generation with the UI Launcher Project I generated (right click on a model file -> generate code), so I cannot launch any generation into debug mode.
Concerning the .emtl file, it does contain the right metamodel uri.
But as I explained earlier, in one of the two scenarios, the generation won't work, even though the two solutions are based on the very same .emtl file.
Regards,
Simon
EDIT : I rebuild the update-site, and it now works... I basically didn't change a single line of code, so I'm not sure to understand what was happening. However, I'd be interested in a way of launching a generation in debug mode via the UI Launcher Project, if it is possible. Thanks.
[Updated on: Tue, 20 September 2011 04:04] by Moderator
|
|
| |
Re: [Acceleo 3.1] Metamodel loading issues [message #729447 is a reply to message #728562] |
Mon, 26 September 2011 04:28   |
Eclipse User |
|
|
|
Simon,
Other than differences between your two eclipses (the one in which you install the generators missing some dependencies)... I don't really know what could be happening. You can still debug even in this Eclipse, though it is a little more convoluted. Notably, you ought to have the Acceleo SDK installed (and not just the runtime) but when you have it, in the Eclipse you have installed the generators :
Import the Acceleo code :
- Right-click the package explorer and select "Import... > Plug-ins and fragments"
- In the third group "Import As", tick "Projects with source folders" and hit "Next>"
- Filter on "*acceleo" and double-click at least "org.eclipse.acceleo.engine"
- Open AbstractAcceleoGenerator, and place a breakpoint as mentionned in my first post on this thread.
Launch the debug :
- Click on Run > Debug Configurations...
- Double-click "Eclipse Application" then hit "Debug"
- In the new runtime Eclipse you just launched, import the projects containing the model on which you want to launch a generation, then launch it (either through a plugin UI, right-clicking on the model and selecting the accurate menu item, or through a launch config. Whatever the means, the breakpoint you set in your first Eclipse should be hit).
That should at least make for a starting point to determine what could possibly go wrong here.
Laurent Goubet
Obeo
|
|
| | | |
Re: [Acceleo 3.1] Metamodel loading issues [message #730045 is a reply to message #729560] |
Tue, 27 September 2011 10:33   |
Eclipse User |
|
|
|
Hi,
If the templates have parameters with empty types, we didn't found the metamodel when we have loaded the modules. There are two possibles explanations:
- when you are producing your update site, the emtl files, preferably serialized as XMI based resources (not binary) do not have the metamodel declared like this:
<input>
<takesTypesFrom href="http://www.eclipse.org/uml2/3.0.0/UML#/"/>
</input>
But like that:
<input>
<takesTypesFrom href="<path_to_my_ecore_file>"/>
</input>
And once deployed in your Eclipse, we can't find "<path_to_my_ecore_file>" anymore. In that case, the parameters or the type of the template should be an EMF proxy. You can have a look at its uri (EcoreUtil.getURI(...)) to see what metamodel we are looking for.
- Or, the emtl in the jars of your update site are ok, and the metamodel is not correctly registered in the other Eclipse. You can create a new empty ecore model in your Eclipse and then right click -> load resource and browse register package to see if it is there. You can use AcceleoPackageRegistry.getEPackage(String) to see if the package matching your URI is there before the loading of your Acceleo module in the initialize method of your Java launcher.
Regards,
Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Google+: stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
|
|
| | | |
Re: [Acceleo 3.1] Metamodel loading issues [message #730886 is a reply to message #730083] |
Thu, 29 September 2011 08:39   |
Eclipse User |
|
|
|
Hi Simon
You might want to review
https://bugs.eclipse.org/bugs/show_bug.cgi?id=345708 to see if your
problems bear any resemblance to some that I have. I notice a reference
to the UML metamodel earlier in this thread. If you have UML open as a
project then that may cause interesting effects. I recommend avoiding
the possibility that platform:/resource/... and platform:/plugin/...
could reference different files; I find Acceleo and many other tools are
weak on URI resolution, particularly standalone, and even more so when
plugin and standalone need to co-operate (editor + executor). MWE has
some interesting classpath technology in its StandaloneSetup that I've
just wrapped up as a simple ResourceSet initializer to register all
plugins and projects in both EcorePlugin.getPlatformResourceMap and the
ResourceSet.getUriConverter().getURIMap(). I plan to contribute this to
EMF once I've tested it a bit more, then maybe projects can stop
providing their own wrong solutions.
Regards
Ed Willink
On 27/09/2011 16:28, simon.vivien wrote:
> Hi,
>
> I checked my emtl files and they are ok.
> Moreover, my metamodel is correctly registered as it appears in the
> registered packages list (I didn't succeed to sysout the getEPackage()
> result, but I will retry tommorow).
> Still, the generation won't work ..
>
>
> Regards,
> Simon.
|
|
| | |
Goto Forum:
Current Time: Thu May 15 15:29:48 EDT 2025
Powered by FUDForum. Page generated in 0.07260 seconds
|