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 05:27  |
Eclipse User |
|
|
|
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 03:24] by Moderator
|
|
| |
Re: [acceleo 3.2.X & Java & Maven] Tutorial for developpers [message #755102 is a reply to message #755059] |
Mon, 07 November 2011 06:54   |
Eclipse User |
|
|
|
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 05:44   |
Eclipse User |
|
|
|
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 #758678 is a reply to message #758167] |
Thu, 24 November 2011 03:22  |
Eclipse User |
|
|
|
I finally found why the Acceleo compiler didn't found such emtl files.
I put the wrong parameter in the source files to consider (problem of path references).
And, finally, it works fine out of Eclipse !!!
For those who are interested in, here is the solution i found :
- Install Acceleo on a classic Eclipse installation,
- Use the maven goal eclipse:to-maven, and give with the parameter "-DeclipseDir" the path to your eclipse installation. This will put all your eclipse's plugins actually installed on your local maven repository, including Acceleo and its dependencies.
- Run the goal package on the project associated to this post. Use a diff in order to check if the data generated (data/out) are correct wrt the oracle (data/out_oracle)
Thank you Stephane for your help, i appreciate a lot.
|
|
|
Goto Forum:
Current Time: Wed Jul 23 12:50:39 EDT 2025
Powered by FUDForum. Page generated in 0.32286 seconds
|