Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Standalone
[Acceleo] Standalone [message #1228515] Tue, 07 January 2014 11:53 Go to next message
Joe I is currently offline Joe IFriend
Messages: 28
Registered: May 2013
Junior Member
Hi,

I have three use cases for my uml-to-xml acceleo generator.
1) Run it inside eclipse -> works out of the box
2) Export the generator as jar and use it as command line program -> I have troubles...
3) Add the generator to the dependencies of another java plugin-project and generate. Preferable I would also like to export it as runnable jar -> Same troubles Sad

First of all I uncommented the uml stuff in registerResourceFactories and registerPackages. Also I reexport the dependencies of the uml-to-xml generator, to use it in my third use case.

I tried the following steps:
In my first try, after I exported the generator as Runnable-Jar, I got the following error while running it:
C:\Users\home\acceleojava.io.IOException: '/org/tat/pim/uml/gen/xml/main/generate.emtl' not found
        at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGen
erator.java:451)
        at org.tat.pim.uml.gen.xml.main.Generate.<init>(Generate.java:91)
        at org.tat.pim.uml.gen.xml.main.Generate.main(Generate.java:145)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)


So for my second try, I also checked 'Save as ANT script' and after running this ANT script, the emtl files were included in the jar. But I got the following error:

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.RuntimeException: Cannot create a resource for 'rsrc%3Aorg/tat/pim/uml/gen
/xml/main/generate.emtl'; a registered resource factory is needed
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:403)

        at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:361)
        at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGen
erator.java:455)
        at org.tat.pim.uml.gen.xml.main.Generate.<init>(Generate.java:91)
        at org.tat.pim.uml.gen.xml.main.Generate.main(Generate.java:145)
        ... 5 more


I added the following code to registerPackages:
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emtl", new EMtlResourceFactoryImpl());


Generated everything again and got the following error:
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.
FileNotFoundException: C:\Users\home\acceleo\rsrc%3Aorg\tat\pim\uml\gen\xml\main\gen
erate.emtl 
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSet
Impl.java:319)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java
:278)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)

        at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:361)
        at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGen
erator.java:455)
        at org.iti.ubtl.pim.uml.gen.xml.main.Generate.<init>(Generate.java:92)
        at org.iti.ubtl.pim.uml.gen.xml.main.Generate.main(Generate.java:146)
        ... 5 more
Caused by: java.io.FileNotFoundException: C:\Users\home\acceleo\rsrc%3Aorg\tat\pim\p
oe\gen\xml\main\generate.emtl 
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at org.eclipse.emf.ecore.resource.impl.FileURIHandlerImpl.createInputStream(FileURIHandlerIm
pl.java:99)
        at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(Extensib
leURIConverterImpl.java:360)
        at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1269)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java
:274)
        ... 10 more


Now I'm stuck. It seems that I have to change the URIConverter, but I don't know how and with what...

Thanks for any help!
Re: [Acceleo] Standalone [message #1233913 is a reply to message #1228515] Mon, 20 January 2014 20:45 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

How are you building your Acceleo generator? You should use the Acceleo maven plugin for that. Have a look at the generator here.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
Re: [Acceleo] Standalone [message #1235560 is a reply to message #1233913] Fri, 24 January 2014 17:07 Go to previous message
Joe I is currently offline Joe IFriend
Messages: 28
Registered: May 2013
Junior Member
Ok, so there is no other way than building it with maven...

Thanks!
Previous Topic:[Acceleo] Standalone usage not possible
Next Topic:[Acceleo 3.4.x] How to import template / modul?
Goto Forum:
  


Current Time: Sat Oct 12 04:33:37 GMT 2024

Powered by FUDForum. Page generated in 0.04286 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top