Eclipse Maven Tycho Xtext Archetype
Maven archetype that creates an Xtext project with a multi module Maven layout and Tycho (manifest-first approach). The archetype was created using the Maven Xtext Example.
>com.mycompany.mydsl
|-- com.mycompany.mydsl
|-- com.mycompany.mydsl.ide
|-- com.mycompany.mydsl.sdk
|-- com.mycompany.mydsl.tests
|-- com.mycompany.mydsl.ui
|-- com.mycompany.mydsl.updatesite
`-- example-project
`-- example-project-gradle
- .mydsl Grammar and base classes for the DSL.
- .mydsl.ide Standalone setup.
- .mydsl.sdk The feature.
- .mydsl.tests Contains the tests.
- .mydsl.ui UI related parts.
- .mydsl.updatesite Creates a P2 repository that contains the plugin.
- example-project Example Maven DSL project
- example-project-gradle Example Gradle DSL project
- Java JDK 1.7 is installed
- Maven 3 is installed.
- Eclipse with Xtext is installed (Download Pre-Configured Eclipse With Xtext)
- M2E Eclipse Plugin is installed (Help / Eclipse Market Place... / Find "M2E" / Install "Maven Integration for Eclipse (Juno and newer)")
- M2E Tycho Connector is installed (Window /Prefences / Maven / Discovery / Open Catalog / Install M2E Connectors / Find "Tycho" / Install "Tycho Configurator")
- The Eclipse and Xtext repositories are added to your .m2/settings.xml to make them accessible for Maven:
<repositories>
<repository>
<id>eclipse-neon</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/neon</url>
</repository>
<repository>
<id>xtext-update-site</id>
<layout>p2</layout>
<url>http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/</url>
</repository>
</repositories>
Mandatory Parameters
mvn archetype:generate \
-DarchetypeGroupId=org.fuin.archetypes \
-DarchetypeArtifactId=emt-xtext-archetype \
-DarchetypeVersion=0.2.1
All Parameters
mvn archetype:generate \
-DarchetypeGroupId=org.fuin.archetypes \
-DarchetypeArtifactId=emt-xtext-archetype \
-DarchetypeVersion=0.2.1 \
-DgroupId="com.mycompany.mydsl" \
-DartifactId="com.mycompany.mydsl" \
-Dversion="0.1.0-SNAPSHOT" \
-DeclipseVersion="0.1.0.qualifier" \
-Dpackage="com.mycompany.mydsl" \
-DpackagePath="com/mycompany/mydsl" \
-DbasePackage="com.mycompany" \
-DbasePackagePath="com/mycompany" \
-DdslName="MyDSL" \
-DtechName="mydsl" \
-DdslExtension="mydsl" \
-DfullName="My DSL" \
-Durl="http://www.mycompany.com/"
Explanation
Parameter | Default Value | Description |
---|---|---|
groupId | com.mycompany.mydsl | Maven 'groupId' |
artifactId | com.mycompany.mydsl | Maven 'artifactId' |
version | 0.1.0-SNAPSHOT | Maven 'version' |
eclipseVersion | 0.1.0.qualifier | Eclipse version - Should be identical to the Maven version except for snapshots (with a '.qualifier' instead of '-SNAPSHOT') |
package | com.mycompany.mydsl | Java Package (Should be most of the times identical to the 'groupId') |
packagePath | com/mycompany/mydsl | Same as package, but instead of '.' the '/' is used as separator |
dslName | MyDSL | Unique short name of the DSL - Only upper and lower case characters ('A'-'Z', 'a'-'z', No spaces) |
techName | mydsl | A short technical name of the DSL - Only lower case characters ('a'-'z', No spaces) |
dslExtension | mydsl | File extension for the DSL model files |
fullName | My DSL | A short descriptive name of the DSL |
url | http://www.mycompany.com/ | Company URL - Used for example in the Eclipse 'product' description |
Snapshots can be found on the OSS Sonatype Snapshots Repository.
Add the following to your .m2/settings.xml to enable snapshots:
<repository>
<id>sonatype.oss.snapshots</id>
<name>Sonatype OSS Snapshot Repository</name>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
If you're looking for more Maven archetypes, take a look at Open Archetypes.