Xtext comes with pretty good documentation, but if you want to automate the build for your little new DSL, you’re drifting into deep water. There is some documentation on the Net, but even if you are an advanced Maven user, it’s easy to get lost with the Tycho plugin.
That’s why I made a Maven Archetype that creates a standard multi-module Maven layout and that also includes a P2 repository project, which is missing when you use the standard Eclipse Xtext wizard.
If you just want to use the default settings, simply execute the following on the command line:
mvn archetype:generate \ -DarchetypeGroupId=org.fuin.archetypes \ -DarchetypeArtifactId=emt-xtext-archetype \ -DarchetypeVersion=0.1.0
It will generate the following project structure:
>com.mycompany.mydsl |-- com.mycompany.mydsl.dsl |-- com.mycompany.mydsl.repository |-- com.mycompany.mydsl.sdk |-- com.mycompany.mydsl.tests |-- com.mycompany.mydsl.ui `-- mydsl-test
.mydsl | Maven parent project. | [Maven project] |
.mydsl.dsl | Grammar and base classes for the DSL | [Tycho ‘eclipse-plugin’] |
.mydsl.repository | Creates a P2 repository. | [Tycho ‘eclipse-repository’] |
.mydsl.sdk | Eclipse feature project | [Tycho ‘eclipse-feature’] |
.mydsl.tests | Unit test project. | [Tycho ‘eclipse-test-plugin’] |
.mydsl.ui | UI related parts. | [Tycho ‘eclipse-plugin’] |
.mydsl-test | Example DSL project. | [Eclipse project] |
When you start creating a real project, you should also add the other parameters that are available for the generate command.
For a full description of the archetype, just visit the project page on GitHub: https://github.com/fuinorg/emt-xtext-archetype