[EcoreGen] State-of-the-art way to generate code from Ecore in Maven? [message #1796398] |
Fri, 12 October 2018 11:29  |
Niko Stotz Messages: 8 Registered: June 2010 |
Junior Member |
|
|
Hi all,
I'm working on a product with several projects, each containing one ecore model. These models depend on one another (without circles). Within Eclipse, I can generate the code by manually running the generator on each genModel.
However, automating this using Maven has proven to be a challenge.
I've found multiple posts that are closely related to my problem, such as:
https://www.eclipse.org/forums/index.php/t/202345/, a post describing to use an Ant task.
I've also come across mentions of running a headless eclipse version to generate the required code, but no clear documentation on how to get started with that.
Since the posts I found are from ~2010 or earlier, my question is as follows: is that Ant task (or the headless eclipse solution) still the preferred solution, or is there something newer that I've missed? Might an MWE2 workflow be helpful?
Thanks a lot.
|
|
|
|
Re: [EcoreGen] State-of-the-art way to generate code from Ecore in Maven? [message #1796487 is a reply to message #1796400] |
Mon, 15 October 2018 08:25   |
Jan Jansen Messages: 17 Registered: October 2018 |
Junior Member |
|
|
Hi Ed,
Thank you for your thorough answer!
If I read and understand the script correctly, I'd have to write my own variant of the EcoreGenModelSetup/GenerateModel classes as necessary for the project(s)?
Regards,
Jan
Edit:
I've actually got it working with the following workflow:
Workflow {
bean = org.eclipse.xtext.ecore.EcoreSupport {}
bean = ResourceSetImpl : resourceSet {}
bean = StandaloneSetup { resourceSet = resourceSet
platformUri = "${rootPath}"
scanClassPath = true
}
component = org.eclipse.emf.mwe2.ecore.EcoreGenerator {
genModel = "platform:/resource/${projectName}/model/ModelName.genmodel"
srcPath = "platform:/resource/${projectName}/emf-gen"
}
}
Thanks again Ed!
[Updated on: Mon, 15 October 2018 09:07] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02859 seconds