Just before summer vacations, I’ve wrote a post on Launching Acceleo generation from Maven and that seems to interest many people out there. Many questions came out on configuration details, encountered problems, compatibility issues with Tycho system and so on …
So here’s a short sequel to introduce a repository I put on GitHub in order to illustrate the use case that was previously introduced. For the impatient ones, just go to https://github.com/lbroudoux/acceleo-maven-sample to check the source code.
I’ve post a sequel to this blog post here : https://lbroudoux.wordpress.com/2013/04/21/launching-acceleo-generation-from-maven-take-3/ that deals with portability issues on the build. The demo project on Github has evolved in consequence.
Since my last post, I’ve made the use case a little bit more complex by introducing an another Acceleo project that is having a dependecy with a first one. The schema below summarizes the artifacts locations, names and dependencies :
And here’s a brief introduction on artifact content and their location with GitHub repository :
This is the base artifact. It is an Acceleo module that provides some basic UML to Java templates. It is bundled as a Maven artifact and thus has a pom.xml. Sources can be found here.
This is an Acceleo module that provides basic UML to Java Persistence APIs template. It is also bundled as a Maven artifact and thus has a pom.xml with a dependency to basic uml module. Sources can be found here.
This is a sample application that contains a UML model (
myapp.uml) with only an entity (
Stuff class). It is bundled as a Maven artifact and the pom.xml defines an Acceleo generation step bound to the
generate-sources Maven lifecycle phase. After that phase, a unit test (
StuffTest.java) ensures that things have been correctly generated from our JPA Acceleo module that also uses basic Java Acceleo module. Sources can be found here.
How to use it ?
git clone the repository, and then execute the following commands :
acceleo-maven-sample$ cd com.github.lbroudoux.acceleo.uml.java acceleo-maven-sample/com.github.lbroudoux.acceleo.uml.java$ mvn clean install ... acceleo-maven-sample/com.github.lbroudoux.acceleo.uml.java$ cd ../com.github.lbroudoux.acceleo.uml.java.jpa acceleo-maven-sample/com.github.lbroudoux.acceleo.uml.java.jpa$ mvn clean install ... acceleo-maven-sample/com.github.lbroudoux.acceleo.uml.java.jpa$ cd ../com.github.lbroudoux.myapp acceleo-maven-sample/com.github.lbroudoux.acceleo.uml.java.jpa$ mvn clean test
The build should all be successfull : look at the console output and you’ll see trace of Acceleo generation.
In the fourthcming weeks, I’ll try to make the Maven builds compliant with Tycho. Let me know if it help some of you and do not hesitate forking and enhancing !