Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340036

Summary: Provide a maven integration plugin
Product: [Modeling] Acceleo Reporter: Mariot Chauvin <mariot.chauvin>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: cmordant1, ivalo, ptitjes, sbouchet, stephane.begaudeau
Version: 3.0.0Flags: mariot.chauvin: indigo+
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: maven
Bug Depends on: 340740    
Bug Blocks: 365557    
Attachments:
Description Flags
Maven 3 Acceleo plugin contribution for compiling templates and generating text.
none
Acceleo template project example for Acceleo Maven plugin none

Description Mariot Chauvin CLA 2011-03-15 10:57:56 EDT
To work well with maven, Acceleo should provide a maven integration plugin which will trigger the use of the Acceleo compiler.

I am not a maven expert so technical solution may change, but goal is to integrate smoothly with maven.
Comment 1 Stephane Begaudeau CLA 2011-04-20 08:18:20 EDT
Starting with Acceleo 3.1M7 we will now have a pom.xml file that will be automatically created to launch the compilation. A maven archetype for Acceleo is also available on the Acceleo CVS repository. Project created with this archetype will use Tycho as Acceleo bundles are not available on the maven repository of the Eclipse foundation yet.
Comment 2 Charlie Mordant CLA 2011-05-16 03:06:11 EDT
Hi,

I've got the M7 plugin from the nightlies repo.
When I create a New Acceleo project, I don't see any pom, just an Ant task with eclipse installation linked resource (not so good for continuous build integration).

What's the status of this enhancement?
Comment 3 Stephane Begaudeau CLA 2011-05-16 03:39:23 EDT
In Acceleo 3.1.0 RC1, which will be released tomorrow, an action is available to create the pom.xml (right click -> Acceleo -> Generate pom.xml). A similar action will be available to create an Ant file for the headless compilation. The pom.xml was automatically created before but some of our user may have no interest in maven so we won't create it automatically now.

The pom.xml is directly inspired from the Acceleo Maven archetype (available right now only on the CVS repository of Acceleo: http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.m2t/org.eclipse.acceleo/maven/?root=Modeling_Project).

This pom.xml will use Tycho to create an Eclipse bundle. The action (that I am improving this morning) will generate the pom.xml and a Java class to let the user customize some options of the headless compilation (register additional packages or other resource factories for example).
Comment 4 Didier Villevalois CLA 2011-06-17 07:28:07 EDT
(In reply to comment #3)
> This pom.xml will use Tycho to create an Eclipse bundle. The action (that I am
> improving this morning) will generate the pom.xml and a Java class to let the
> user customize some options of the headless compilation (register additional
> packages or other resource factories for example).

I might be wrong but it seems to me that this ties an Acceleo generator to be an eclipse plugin.

In our project, we need to build our Acceleo generator to produce a pure Java/EMF generator library. That generator will then be called as part of a maven plugin.

I guess this should not be a problem as the Acceleo compiler can run outside Eclipse and the produced java code can be ran outside Eclipse, right ?

Will you cover that use case ?
Comment 5 Stephane Begaudeau CLA 2011-07-06 03:39:17 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > This pom.xml will use Tycho to create an Eclipse bundle. The action (that I am
> > improving this morning) will generate the pom.xml and a Java class to let the
> > user customize some options of the headless compilation (register additional
> > packages or other resource factories for example).
> 
> I might be wrong but it seems to me that this ties an Acceleo generator to be
> an eclipse plugin.
> 
> In our project, we need to build our Acceleo generator to produce a pure
> Java/EMF generator library. That generator will then be called as part of a
> maven plugin.
> 
> I guess this should not be a problem as the Acceleo compiler can run outside
> Eclipse and the produced java code can be ran outside Eclipse, right ?
> 
> Will you cover that use case ?

We will cover that use case but we will need the jars of the Acceleo project on a maven repository first. The Eclipse Foundation is currently working on making all the jars of all the Eclipse projects on a maven repository.
http://dev.eclipse.org/mhonarc/lists/cross-project-issues-dev/msg06324.html
Comment 6 Markku Saarela CLA 2011-08-12 16:53:18 EDT
I have implemented Maven 3 plugin (with 2 mojo's) to compile templates and generate text. I can contribute that code.
Comment 7 Mariot Chauvin CLA 2011-08-12 17:01:27 EDT
(In reply to comment #6)
> I have implemented Maven 3 plugin (with 2 mojo's) to compile templates and
> generate text. I can contribute that code.

Hi Marku,

That will be an awesome contribution, so feel free to provide the code here on this bugzilla as an attachement.

Cheers
Comment 8 Markku Saarela CLA 2011-08-12 17:14:16 EDT
How to proceed? It is part of my Sourceforge project with Apache 2 license headers in files. I can change license. Of course there is pain of installing Acceleo dependencies that are not available in some Maven repository yet(simple script can do that until all required dependencies are in ex Maven Central).
Comment 9 Didier Villevalois CLA 2011-08-15 07:22:50 EDT
Hi all,

We also have a working plugin since July. We intended to give that to Acceleo project and I completely forgot to add the info in this ticket :p

I deliberately used org.eclipse.acceleo.maven package name. But I did not yet put any Licence files nor headers. You can use that as your own and incorporate it in Acceleo if the project pleases you. Just tell me where I can get the official version when it is incorporated.

https://github.com/ptitjes/maven-acceleo-compiler-plugin

This is a maven project that builds a maven plugin to build some acceleo templates. It needs some dependencies from the Eclipse workspace. So to export your dependencies to the local maven repository you can use that project:

https://github.com/ptitjes/tools-bundle2maven

That tool is a command-line tool that takes the path to your Eclipse plugin directory and a list of the maven dependency names (for instance: "org.eclipse.acceleo:org.eclipse.acceleo.engine"). Be careful that it uses java's Process class so it may not work correctly on some Windows.

Enjoy. Comments are welcome.
Comment 10 Stephane Begaudeau CLA 2011-08-16 07:37:25 EDT
>>> But I did not yet put any Licence files nor headers.
The Eclipse Foundation uses mostly the Eclipse Public Licence: http://en.wikipedia.org/wiki/Eclipse_Public_License

You may use something else but some open source licence like the GPL for example are not compatible with the EPL (the GPL would require Acceleo and Eclipse to be under the GPL). Thus EPL is the easiest solution for a piece of open source code that should be integrated in an Eclipse project.
Comment 11 Markku Saarela CLA 2011-08-16 15:50:43 EDT
Created attachment 201604 [details]
Maven 3 Acceleo plugin contribution for compiling templates and generating text.

Now licence headers changed from Apache to EPL.
Attachment Maven 3 plugin for compiling templates and generating text.

Install Acceleo Eclipse dependencies in pom.xml in you local Maven repository or better upload them into some Maven Repository Management implementation. Hopefully sometime all dependencies are available in some Maven global repository.
Run mvn install site in order to get plugin available in you local environment and to get plugin site documentation generated. In this generated site is preliminary documentation for configurations.
Comment 12 Markku Saarela CLA 2011-08-16 16:00:12 EDT
Created attachment 201606 [details]
Acceleo template project example for Acceleo Maven plugin

This example how to compile templates and install as Maven dependency to use in generator project. This should be part of plugin project site generation.

Feel free to ask help or examples.
Comment 13 Didier Villevalois CLA 2011-08-18 07:23:54 EDT
(In reply to comment #10)
> The Eclipse Foundation uses mostly the Eclipse Public Licence:
> http://en.wikipedia.org/wiki/Eclipse_Public_License

We don't mind at all what license you put as the plugin will be downloaded as part of our build process. So it seems logical to use EPL.

I'm sorry but I will not have any time to work on a possible comparison/integration with Markku Saarela's work. Maybe someone from the Acceleo project can look at it ?
Comment 14 Mariot Chauvin CLA 2011-08-18 08:00:47 EDT
(In reply to comment #11)
> Created attachment 201604 [details]
> Maven 3 Acceleo plugin contribution for compiling templates and generating
> text.
> 
> Now licence headers changed from Apache to EPL.
> Attachment Maven 3 plugin for compiling templates and generating text.
> 
> Install Acceleo Eclipse dependencies in pom.xml in you local Maven repository
> or better upload them into some Maven Repository Management implementation.
> Hopefully sometime all dependencies are available in some Maven global
> repository.
> Run mvn install site in order to get plugin available in you local environment
> and to get plugin site documentation generated. In this generated site is
> preliminary documentation for configurations.

Thanks Markku !

To integrate this we need that you confirm in a comment about the attached files that :
 
- You wrote 100% of the code
- You have the right to contribute the code to
Eclipse
Comment 15 Mariot Chauvin CLA 2011-08-18 08:16:04 EDT
(In reply to comment #13)
> (In reply to comment #10)
> > The Eclipse Foundation uses mostly the Eclipse Public Licence:
> > http://en.wikipedia.org/wiki/Eclipse_Public_License
> 
> We don't mind at all what license you put as the plugin will be downloaded as
> part of our build process. So it seems logical to use EPL.
> 

To integrate your code, we are mandatory to follow the Eclipse IP Process.
So we need that you follow the following steps :

- Attach your code to this bugzilla with for each file a header  which contains the EPL declaration (See http://www.eclipse.org/legal/copyrightandlicensenotice.php for a template)
- Confirm in a comment that you wrote 100% of the code and hat you have the
right to contribute the code to Eclipse

You may find reference of this duties in the Eclipse IP Process Poster : http://www.eclipse.org/legal/EclipseLegalProcessPoster.pdf   

Thanks for your comprehension, we understand that it could be unwieldy.

> I'm sorry but I will not have any time to work on a possible
> comparison/integration with Markku Saarela's work. Maybe someone from the
> Acceleo project can look at it ?

Yes we will have a look to both implementation and compare them. We will probably mix them to have a great implementation integrated in Acceleo :)

Anyway thanks for your contribution.
Comment 16 Markku Saarela CLA 2011-08-18 13:46:26 EDT
I have wrote all the code of my contributionand so I have all rights to contribute my code to Eclipse foundation.
Comment 17 Markku Saarela CLA 2011-08-18 13:55:18 EDT
I have wrote all the code of my contributions in attachments
Maven 3 Acceleo plugin contribution for compiling templates and generating text.  (https://bugs.eclipse.org/bugs/attachment.cgi?id=201604)
and Acceleo template project example for Acceleo Maven plugin (https://bugs.eclipse.org/bugs/attachment.cgi?id=201606)

So I have all rights to contribute my code to the Eclipse foundation.

Markku Saarela
Comment 18 Markku Saarela CLA 2011-08-18 14:19:18 EDT
I am happy to contribute more code or documentation (at least site documentation from my contribution is not completed yet) of this Maven integration plugin, what ever mixed implementation you decide to publish( mine combined with Didier Villevalois contribution). Only thing what matters is that end users are happy of the implementation and usage(i can use that:-)).
Comment 19 Stephane Begaudeau CLA 2012-01-18 09:42:33 EST
More news on the maven integration plugin: http://sbegaudeau.tumblr.com/post/16059815253/maven-integration-in-acceleo
Comment 20 Stephane Begaudeau CLA 2012-06-08 11:32:18 EDT
A first version of the new maven integration plugin is available. It will be officially released with the Juno release (in two / three weeks). The documentation is available on the Eclipse wiki: http://wiki.eclipse.org/Acceleo/Maven

A test project for the stand alone build is available:
http://git.eclipse.org/c/m2t/org.eclipse.acceleo.git/tree/tests/org.eclipse.acceleo.maven.tests

Along with a test project for a tycho based build:
http://git.eclipse.org/c/m2t/org.eclipse.acceleo.git/tree/tests/org.eclipse.acceleo.maven.plugin.tests

The lifecycle of this maven plugin is separated from the Acceleo project lifecycle and as such new improvements may arrive without having to wait for a new official release of Acceleo.

Feel free to re-open this issue if you find a bug or if you want a new feature in this maven plugin.
Comment 21 Laurent Goubet CLA 2015-05-27 08:55:45 EDT
Closing resolved bugs