Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Metamodel registered, but still...("there are no model elements that matches at least.....")
[Acceleo] Metamodel registered, but still... [message #707935] |
Tue, 02 August 2011 08:42 |
A Vernotte Messages: 21 Registered: June 2011 |
Junior Member |
|
|
Hi,
I'm creating a plugin for Papyrus, in which I perform M2M and M2T. It works as follows : first, a native metamodel transformation from UML to a dedicated metamodel. Then, an extension point "modelTransformation" is set to accept model transformations from this dedicated metamodel to any other, and it has an attribute "codeGeneration" to link this transformation to a code generation module.
I didn't have any trouble transforming models, but I can't get to launch the code generation. I've got this error
!ENTRY org.eclipse.acceleo.engine 2 0 2011-08-02 10:03:47.137
!MESSAGE 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.
The metamodel I use isn't registered, it would seem. But it is well registered indeed, as I used the extension org.eclipse.emf.ecore.dynamic_package to get it done, and I can tell it works because (for example) modisco browser can go through the generated xmi.
Let's see then how the code generation is executed :
@Override
public void run() throws Exception {
((AbstractAcceleoGenerator) codeGen).initialize(URI.createURI(model),currentProject.getFullPath().toFile(), args);
((AbstractAcceleoGenerator) codeGen).doGenerate(new BasicMonitor());
}
model is a string containing the full name of the xmi file. The URI created from it contains the first Element (an EClassImpl) of the xmi file. I guess that's how it's supposed to be.
currentProject is the current active IProject, I tested it and it correspond to what's expected.
I tried in the template to replace the package ns uri with a relative and an absolute path, it didn't change a thing (wasn't worse tho).
I should mention that the generation works when executed alone in my dev eclipse instance.
I really don't know what to do. If you could please point me to the right direction, it would help a lot. Thank you for reading all this.
A
[Updated on: Tue, 02 August 2011 09:04] Report message to a moderator
|
|
|
Re: [Acceleo] Metamodel registered, but still... [message #709710 is a reply to message #707935] |
Thu, 04 August 2011 08:03 |
|
Hi,
This issue can come from two things : either 1) the metamodel wasn't properly registered, or 2) the input model wasn't loaded as it should. This is an area where we need to enhance Acceleo so that it diagnoses the model loading issues.
I would say that your case is the 2). Please try to change your "model" URI to a fragment-less URI (i.e : "The URI created from it contains the first Element (an EClassImpl) of the xmi file" : remove the "first Element" from the URI). Your URI currently looks like "protocol:/path/to/model.xmi#//EClass1". It should be of the form :
- "platform:/resource/project/path/to/model.xmi" or
- "file:/absolute/path/to/model.xmi" or even
- "platform:/plugin/pluginID/path/to/model.xmi".
Acceleo will handle the search for the "input" EObjects itself. If you have a "main" template that takes an EClass as its input, Acceleo will call the generation for all EClasses contained by your model. Your best bet would be to debug the launch that works ("the generation works when executed alone in my dev eclipse instance") and see what the URI that is used in that case looks like.
Laurent Goubet
Obeo
|
|
| | | | | |
Re: [Acceleo] Metamodel registered, but still... [message #714745 is a reply to message #714644] |
Thu, 11 August 2011 12:33 |
A Vernotte Messages: 21 Registered: June 2011 |
Junior Member |
|
|
Thank you for your answer Stephane. But I still can't generate code :'-( I've tried everything, I must have done a stupid mistake and yet I just can't see it...
There must be some kind of incompatibility between the registered package and the xmi file, because on the one hand, my metamodel is registered, and on the other hand the xmi file exists (I tried to give bad URI and exceptions were thrown).
This is weird since it works with the same xmi file when running it via eclipse.
Well, I'll keep searching.
[Updated on: Thu, 11 August 2011 14:26] Report message to a moderator
|
|
| | |
Goto Forum:
Current Time: Sat Nov 09 01:54:42 GMT 2024
Powered by FUDForum. Page generated in 0.24690 seconds
|