0

First of all , I am new to Acceleo and the modeling features of eclipse. What I am trying to do is just to create a simple test file. So for starters, I created a main module:

comment encoding = UTF-8 /]
[module generate('file:/C:/Users/maria/Documents/workspace/org.eclipse.acceleo.module.m2tTransformation/model/PSMMetamodel.ecore')]   

[template public generateElement( aServicePSM : ServicePSM)]
[comment @main/]
[file ('test.java', false, 'UTF-8')]
Test
[/file]
[/template]

When i run this I get:

The generation failed 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 could also come from a missing [comment @main/] in the template used as the entry point of the generation. 

Also the URI I use is the nsURI attribute value I set to the root of metamodel. I am sure that my input model does contain ServicePSM elements. What am i doing wrong?

Thanks in advance.

Sina Darvishi
  • 71
  • 1
  • 11
makou
  • 3
  • 5

1 Answers1

0

This issue will arise in two cases

  1. You do not have an element of the proper type in your model
  2. The metamodel cannot be resolved

From your message I think we can safely ignore 1. since it seems you have at least one ServicePSM in your model, so we need to address 2.

If you look at your module, you've declared it to generate on metamodel file:/C:/Users/maria/Documents/workspace/org.eclipse.acceleo.module.m2tTransformation/model/PSMMetamodel.ecore. However, EMF rarely, if ever, uses this kind of URIs to refer to its metamodels. If you open your actual model with the text editor (right click > Open With > Text Editor), you can look at the URI that's actually been used to reference the metamodel with the "xmlns" tags at the start.

For example, if I open a model that references OCL elements, I can see xmlns:ocl.ecore="http://www.eclipse.org/ocl/1.1.0/Ecore". You have to make sure you use the same URI in your module file as what you see EMF using in the model file, in this case, it would be http://www.eclipse.org/ocl/1.1.0/Ecore.

Kellindil
  • 4,523
  • 21
  • 20