How to Run Xtext (and other MWE2 Workflows) with Ant

Some days ago Sebastian showed How to Deploy Xtext to a Headless Plain-Java Envorinment. It’s nearly as easy to run the Xtext generator with Apache Ant.

You just need the required libraries and the following Ant snippet to run the Xtext generator (or any other MWE2 workflow):

	<path id="gen.classpath">
		<fileset dir="lib" includes="*.jar"/>
		<pathelement location="src"/>
	</path>
 
	<target name="gen">
		<java classname="org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher" classpathref="gen.classpath" fork="true">
			<arg value="path/to/your/workflow.mwe2"/>
		</java>
	</target>

Using Xtext 1.0 the following libraries are required to run the generator:

antlr-2.7.7.jar
antlr-3.0.1.jar
com.google.collect_0.8.0.v201006161118.jar
com.google.inject_2.0.0.v201003051000.jar
com.ibm.icu_4.2.1.v20100412.jar
de.itemis.xtext.antlr_1.0.0.v201006151527.jar
org.antlr.runtime_3.0.0.v200803061811.jar
org.apache.commons.cli_1.0.0.v20080604-1500.jar
org.apache.commons.logging_1.1.1.v201005080502.jar
org.apache.log4j_1.2.15.v201005080500.jar
org.eclipse.emf.codegen.ecore_2.6.0.v20100614-1136.jar
org.eclipse.emf.codegen_2.6.0.v20100614-1136.jar
org.eclipse.emf.common_2.6.0.v20100614-1136.jar
org.eclipse.emf.ecore.xmi_2.5.0.v20100521-1846.jar
org.eclipse.emf.ecore_2.6.0.v20100614-1136.jar
org.eclipse.emf.mwe.core_1.0.0.v201006150535.jar
org.eclipse.emf.mwe.utils_1.0.0.v201006150535.jar
org.eclipse.emf.mwe2.language_1.0.0.v201006150907.jar
org.eclipse.emf.mwe2.launch_1.0.0.v201006150907.jar
org.eclipse.emf.mwe2.runtime_1.0.0.v201006150446.jar
org.eclipse.xpand_1.0.0.v201006150611.jar
org.eclipse.xtend.typesystem.emf_1.0.0.v201006150611.jar
org.eclipse.xtend.util.stdlib_1.0.0.v201006150611.jar
org.eclipse.xtend_1.0.0.v201006150611.jar
org.eclipse.xtext.common.types_1.0.0.v201006161118.jar
org.eclipse.xtext.generator_1.0.0.v201006161118.jar
org.eclipse.xtext.util_1.0.0.v201006161118.jar
org.eclipse.xtext.xtend_1.0.0.v201006161118.jar
org.eclipse.xtext_1.0.0.v201006161118.jar
stringtemplate-3.1b1.jar
Tags » , , , «

Autor:
Datum: Freitag, 2. Juli 2010 20:23
Trackback: Trackback-URL Themengebiet: MDSD

Feed zum Beitrag: RSS 2.0 Diesen Artikel kommentieren

5 Kommentare

  1. 1

    I wonder why the emf codegen classes are required:

    org.eclipse.emf.codegen.ecore_2.6.0.v20100614-1136.jar
    org.eclipse.emf.codegen_2.6.0.v20100614-1136.jar
    antlr-2.7.7.jar

    I think those are only needed if the language changes but not running a generator.

    Michael

  2. 2

    Thats right. Some libraries mentioned above (like emf.codegen.* and antlr) are only required to run the Xtext generator itself and not for MWE2 workflows using an Xtext based language.

  3. 3

    Hello,

    is there a possibility to add more arguments and if, how to access them inside the mwe2 workflow (e.g. a path)?

    Julian.

  4. 4

    Hi Julian,

    I think you can use -p to add parameters:

    	<java classname="org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher" classpathref="gen.classpath" fork="true">
    		<arg value="path/to/your/workflow.mwe2"/>
    		<arg value="-p"/>
    		<arg value="modelFile=my.model"/>
    	</java>
    
  5. 5

    Hi Ingo,

    thx works fine!

Kommentar abgeben