Home » Modeling » M2T (model-to-text transformation) » [acceleo 3.2.X & Java & Maven] Tutorial for developpers [solved]
[acceleo 3.2.X & Java & Maven] Tutorial for developpers [solved] [message #754555] |
Thu, 03 November 2011 09:27 |
P.-C. Bue Messages: 11 Registered: November 2011 |
Junior Member |
|
|
Hello,
I have some questions on the utilisation of Acceleo 3.
First, is there a tutorial or API for developpers, in order to use the core of this tool with Maven and old plain java code, and outside of the Eclipse UI ?
If I understood all what i read on this tool, it works on the same workflow of JJtree & JavaCC, for example. From a .mtl file which described the transformation from a model to a text file, Acceleo generates a set of java classes. These classes are then used to perform transformation of a given model.
I already take a look at this topic (www.eclipse.org/forums/index.php/m/654537/?srch=ant#msg_689894), but when i tried to use the same method (creating a java class that extends AbstractAcceleoGenerator), it results in a NoSuchMethodError.
To be more precise, i have downloaded the runtime of acceleo 3.2.0, and i have used the maven goal eclipse:to-maven (maven.apache.org/plugins/maven-eclipse-plugin/to-maven-mojo.html) in order to add the acceleo's eclipse plugins into my local maven repository.
Then, i have created my class (which extends AbstractAcceleoGenerator). The compilation worked fine, but the execution of the code super.registerResourceFactories(resourceSet) gives an error where the method org.eclipse.emf.ecore.resource.Resource$Factory$Registry.getContentTypeToFactoryMap()Ljava/util/Map does not exists in the jvm. I have tried the same manipulation in another project with the ATL framework (addition in the local repository, compilation, execution), and it works fine.
I think it is a problem in the dependency resolution mechanism performed by maven, but i don't know how to solve it (and if there is any solution) ...
My second question is : if it is not possible to do the job with acceleo 3, is there any solution to make it with acceleo 2 ? If yes, is there any API/tutorial for developpers for Acceleo 2 ?
[Updated on: Thu, 24 November 2011 08:24] Report message to a moderator
|
|
| |
Re: [acceleo 3.2.X & Java & Maven] Tutorial for developpers [message #755102 is a reply to message #755059] |
Mon, 07 November 2011 11:54 |
P.-C. Bue Messages: 11 Registered: November 2011 |
Junior Member |
|
|
Hi stephane,
First of all, thanks for your answer. I appreciate your help.
The POM that is generated worked with Tycho, which is a tool which "try" (in my opinion) to provide Maven support for Eclipse's products builds.
What i want is to generate an Acceleo Generator with maven, but as much as possible outside of the Eclipse's world. I mean, the only dependency that seems to be necessary is with the core of Acceleo. Is it possible to generate an Acceleo Generator with plain Java code ? I hope the answer is yes. In my opinion, i only need the metamodel of the source, the source itself (a model), and the transformation files (*.mtl) ? Am i correct ?
I saw in the generated POM that there is a call to the maven-antrun plugin. Is it possible for an acceleo generator to be generate with ant ?
Regards,
P.-C. Bue
|
|
| |
Re: [acceleo 3.2.X & Java & Maven] Tutorial for developpers [message #755700 is a reply to message #755104] |
Wed, 09 November 2011 10:44 |
|
Hi,
You can find here an example of a complete working example on an Acceleo generator built with Tycho. The Java class that you are talking about is generated along with the pom.xml file, you can find an example of this class here.
Quote:I mean, the only dependency that seems to be necessary is with the core of Acceleo. Is it possible to generate an Acceleo Generator with plain Java code ?
Yes you "only" need the Acceleo runtime but it has some dependencies to EMF and OCL. And yes it is possible to launch a generation from Java out of Eclipse. If you want to use an Acceleo generator out of Eclipse, here is a picture of the dependencies needed to run a (in my case UML to Java) generator. In this picture, you can see that you will need EMF (to handle models), OCL (for the expressions), Acceleo and the dependencies of your metamodel. In order to compile, you would need the Acceleo parser too and I think that it would be enough.
Regards,
Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Google+: stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
|
|
| | |
Re: [acceleo 3.2.X & Java & Maven] Tutorial for developpers [message #756842 is a reply to message #756612] |
Tue, 15 November 2011 10:24 |
|
Hi,
In the pom.xml generated by Acceleo, we are using the Eclipse Indigo update site which contains EMF 2.7:
<profiles>
<profile>
<id>platform-indigo</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>platform-version-name</name>
<value>indigo</value>
</property>
</activation>
<properties>
<eclipse-site>http://download.eclipse.org/releases/indigo</eclipse-site>
<platform-version>[3.7,3.8)</platform-version>
</properties>
</profile>
</profiles>
<repositories>
<repository>
<id>eclipse-platform</id>
<layout>p2</layout>
<url>${eclipse-site}</url>
</repository>
<repository>
<id>acceleo</id>
<layout>p2</layout>
<url>${acceleo-site}</url>
</repository>
</repositories>
You can change the update site in which you want tycho to find the dependencies. With your regular maven build, you must be using the EMF jars from your Eclipse installation which seems to be an Eclipse 3.3 that includes EMF 2.3. You can download an Eclipse 3.7 to use the latest version of EMF. By the way, Acceleo is not supported on Eclipse 3.3 (it """"may"""" work but we don't support it).
Regards,
Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Google+: stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
|
|
| | | |
Goto Forum:
Current Time: Thu Mar 28 10:39:31 GMT 2024
Powered by FUDForum. Page generated in 0.04151 seconds
|