Home » Modeling » M2T (model-to-text transformation) » Generation with Acceleo failed since 3.1.0M7 but worked for 3.1.0M6a (Issues with the Acceleo 3.1.0 version)
Generation with Acceleo failed since 3.1.0M7 but worked for 3.1.0M6a [message #673668] |
Tue, 24 May 2011 12:41  |
Rainer Menke Messages: 7 Registered: July 2009 |
Junior Member |
|
|
I have written a transformation in Acceleo, which uses xml as input. For this I wrote the required contenthandler and everthing else. The transformation works fine in the version 3.1.0M6a.
I haven't changed handling for the xml files, nor the templates for Acceleo. The main template is defined as
[comment encoding = UTF-8 /]
[module generate('xxx')/]
[...]
[template public generate(w : WebType)]
[for( m0 : MenuType | w.menu )]
[generateMenu(m0,w)/]
and the implementation of the Generator is given as:
public void registerPackages(ResourceSet resourceSet) {
super.registerPackages(resourceSet);
// TODO If you need additional package registrations, do them here. The following line is an example for UML.
if (!isInWorkspace(WebmlPackage.class)) {
// The normal package registration if your metamodel is in a plugin.
resourceSet.getPackageRegistry().put(WebmlPackage.eNS_URI, WebmlPackage.eINSTANCE);
} else {
// The package registration that will be used if the metamodel is not deployed in a plugin.
// This should be used if your metamodel is in your workspace.
resourceSet.getPackageRegistry().put("/de.malime.ecore.webml/model/webml.ecore", WebmlPackage.eINSTANCE);
}
}
with an xml file
<?xml version="1.0" ?>
<web theme="theme/malime.css" xmlns="xxxxx" >
<meta name="keywords" value="IBM,Rational Software,RSA,RSM,RFT,RTC,jazz.net,MDA,MBD,MDD,eclipse,plugins,features" />
....
</web>
Since Acceleo 3.1.0M7 I get the warning: "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."
Does somebody have any idea, what could be done or changes to resolve this issue?
TIA
Rainer Menke
|
|
| |
Re: Generation with Acceleo failed since 3.1.0M7 but worked for 3.1.0M6a [message #673966 is a reply to message #673955] |
Wed, 25 May 2011 10:30   |
Rainer Menke Messages: 7 Registered: July 2009 |
Junior Member |
|
|
Hi Laurent,
nothing is generated. It seems like Acceleo is unable to resolve the proxy. I am just debugging it. In former version ( M7,RC1 of Acceleo 3.1.0 ) I got the message that the main template generate( null ) could not be found. Now, I do not see this error any longer. Perhaps it is true anyway, perhaps some implementation errors, but in the later case I do not understand why it has worked in M6a.
I added soe of the debug info, but it seems like the defined "language constructs" could not be resolved:
module generate(org.eclipse.acceleo.model.mtl.impl.TypedModelImpl@6c646c64)
[generate(null)]
in contrast to the emtl-file
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" [...] >
<mtl:Module name="generate" nsURI="de::malime::acceleo::webmenu::files::generate" startHeaderPosition="29" endHeaderPosition="75">
<input>
<takesTypesFrom href="webml#/"/>
</input>
<imports href="generateMenu.emtl#/0"/>
<imports href="generateSubmenu.emtl#/0"/>
<imports href="generateSubsubmenu.emtl#/0"/>
<imports href="common.emtl#/0"/>
<ownedModuleElement xsi:type="mtl:Template" name="generate" visibility="Public">
[...]
<parameter name="w">
<eType xsi:type="ecore:EClass" href="webml#//WebType"/>
</parameter>
</ownedModuleElement>
TIA
Rainer
[Updated on: Wed, 25 May 2011 16:20] Report message to a moderator
|
|
|
Re: Generation with Acceleo failed since 3.1.0M7 but worked for 3.1.0M6a [message #675151 is a reply to message #673966] |
Mon, 30 May 2011 12:37   |
|
Hi,
In Acceleo 3.1.0M7 we have introduced several new features in Acceleo. You may want to try first with Acceleo 3.1.0 RC2.
- Does you project use binary or xmi serialization ? (right click on the project -> properties -> acceleo).
(if binary, switch to xmi since it is easier to debug)
From this "/de.malime.ecore.webml/model/webml.ecore", I imagined that your metamodel is in your workspace. If it is the case, you should try to remove the "!isInworkspace" with the xmi resource serialization.
If you want to use binary resources, you will have to register "/de.malime.ecore.webml/model/webml.ecore" but again try to remove the "!isInWorkspace".
If you are working with a metamodel in the workspace, try to use xmi resource serialization since it will allow you to use the regular registration: (resourceSet.getPackageRegistry().put(WebmlPackage.eNS_URI, WebmlPackage.eINSTANCE)).
Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com
|
|
| |
Re: Generation with Acceleo failed since 3.1.0M7 but worked for 3.1.0M6a [message #676196 is a reply to message #675411] |
Fri, 03 June 2011 07:29   |
|
Hi,
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" [...] >
<mtl:Module name="generate" nsURI="de::malime::acceleo::webmenu::files::generate" startHeaderPosition="29" endHeaderPosition="75">
<input>
<takesTypesFrom href="webml#/"/>
</input>
The uri of your metamodel is "webml" ?
Do you have the same uri in your input model ?
Are you registering your metamodel with the same uri in Eclipse ?
The Launcher Class Generated by Acceleo has two constructors, one which takes the uri of your metamodel, the other one which takes the already loaded model. You should try to use ModelUtils.load(...) to load manually your model and check if the metamodel is correctly resolved. Just like we do it with AbstractAcceleoGenerator#initialize(...) line 415 and line 416.
Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com
|
|
| | | | |
Goto Forum:
Current Time: Sun Dec 10 21:40:23 GMT 2023
Powered by FUDForum. Page generated in 0.02436 seconds
|