Integration with the Eclipse build mechanism

It is time to see our generator in action: launch Eclipse, create a Java project in the workspace, and, in the src folder, create a new .entities file (remember to accept to add the Xtext nature to the project, otherwise the generator will not run). Continue by adding one or more entities with some attributes. Notice that a src-gen folder is automatically created as soon as you save the file. At this point, you should also add this generated folder to the projects source folders by going to Build Path | Use as Source Folder. Exploring the content of the src-gen folder you will find a generated Java class for each entity in your .entities file. You can see an example in the following screenshot.

Note ...

Get Implementing Domain-Specific Languages with Xtext and Xtend now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.