I am trying to generate some code using Acceleo. I am constructing my model entity in-memory and I want to generate the code for it.
Now, when Acceleo tries to match my model object to the argument type of my template function, it does not match. The classes are exactly the same, but since the package registry of Acceleo and my in-memory model is different, they do not match and Acceleo says no matching model element could be found for the main template.
Can I correct this issue? Can I force the acceleo package registry to be the in-memory registry? Can I force class matching on a semantic level (instead of just on Java ==
? )
To answer this question for anyone who comes along here:
The real issue was the URI of my EMF packages. I had a
commons
andcommons.study
package. The URI of thecommons
package was put ashttp://domain.com/model.ecore#/
. Acceleo adds his own (blank)http://domain.com/model.ecore
at runtime, which prevents the proxy resolver from delegating the request to the Workspace.The solution was to rename my root
commons
package to the properhttp://domain.com/model.ecore
and to set thecommons.study
URI tohttp://domain.com/model.ecore#//study
. This way, the Acceleo resource set will not contain a blank package, and delegates the loading correctly towards the Workspace package registry.Please also note that your root package needs to be generated. If not, it is not registered correctly and will not be present in the Workspace package registry. So if the root package only contains a subpackage, add a DUMMY class in it as well.