Domanda

It may seem like I am asking a question already asked before, but the solutions indicated in the other forum posts don't work for me.

I am trying to run an Acceleo project in a standalone.

public void registerPackages(ResourceSet resourceSet) {
    super.registerPackages(resourceSet);

    if(!isInWorkspace(PSMAndroid.PSMAndroidPackage.class)){
        System.out.println("uri: "+PSMAndroid.PSMAndroidPackage.eNS_URI); 
            resourceSet.getPackageRegistry().put(PSMAndroid.PSMAndroidPackage.eNS_URI, PSMAndroid.PSMAndroidPackage.eINSTANCE);
    }
}

And also:

public void registerResourceFactories(ResourceSet resourceSet) {
    super.registerResourceFactories(resourceSet);
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("psmandroid",new XMIResourceFactoryImpl());

}

The module looks like this:

[module componentModule('org.colpaert.mathias.PSMAndroid')]

I am getting following error:

org.eclipse.acceleo.engine.AcceleoEvaluationException: The type of the first parameter of the main template named 'generateModel' is a proxy.

I looked at other posts, but none of that works for me. (here and here)

The generator worked when launched as "acceleo application", without the lines of code above. When I add the lines, running as java application I get the error above. But when I try to run as "acceleo application" again, I get following error:

error

So that does not work anymore.

What should I do?

extra info: I added the ecore model (project with model & genmodel etc) as a project reference in the build path properties of my acceleo generation project.

È stato utile?

Soluzione

The problem was in my metamodel URI. The metamodel was defined using ecore, you should always put "http://" in front of the metamodel URI!

The name of my metamodel was: org.colpaert.mathias.PSMAndroid, it is was imported in my acceleo module as following:

[module model('org.colpaert.mathias.PSMAndroid')/]

This caused acceleo to look for the metamodel in a path relative to the module file. In a standalone, after compilation, this is just the /bin folder.

I changed my ecore metamodel URI, regenerated the genmodel (etc). Next I changed the acceleo module to:

[module model('http://org.colpaert.mathias.PSMAndroid')/],

Cleaned the solution, recompiled and it worked.

Big thanks to Stéphane Bégaudeau, he solved this here (its in french)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top