This example project shows how to download, configure and run Epsilon's Ant tasks from the command line using Ant, Maven and Gradle. To run the examples below, you only need to have Ant, Maven or Gradle installed in your system.
When you run the ant command in the root directory of the project, the following will happen:
build.xml) will download Apache Ivy in a temporary directory<epsilon.emf.loadModel name="Library" modelfile="library.model" metamodelfile="library.ecore"/> <epsilon.eol> for (writer in Writer.all) { (writer.name + " wrote " + writer.books.title.concat(", ")).println(); } <model ref="Library"/> </epsilon.eol>
If everything goes well, the last few lines of the output of the ant command should look like this:
run-epsilon: [epsilon.eol] Agatha Christie wrote Endless Night BUILD SUCCESSFUL
The complete source code is below and in Epsilon's Git repo.
=== “build.xml”
```xml
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/build.xml", true) }}}
```
=== “ivy.xml”
```xml
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/ivy.xml", true) }}}
```
=== “ivysettings.xml”
```xml
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/ivysettings.xml", true) }}}
```
Since Maven can run Ant tasks, Epsilon Ant tasks can also be executed from a Maven build (mvn clean install) as shown below.
=== “pom.xml”
```xml
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/pom.xml", true) }}}
```
Since Gradle can also run Ant tasks, Epsilon Ant tasks can also be executed from a Gradle build (gradle run) as shown below.
=== “build.gradle”
```groovy
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/build.gradle", true) }}}
```
You can also use Flexmi instead of XMI (library.flexmi instead of library.model) for the model, and Emfatic instead of Ecore (library.emf instead of library.ecore) by adding the following dependency to your ANT/Maven/Gradle build.
=== “Ivy/ANT”
```xml <dependency org="org.eclipse.emfatic" name="org.eclipse.emfatic.core" rev="0.8.0-SNAPSHOT" conf="binaries->default"/> ```
=== “Maven”
```xml
<dependency>
<groupId>org.eclipse.emfatic</groupId>
<artifactId>org.eclipse.emfatic.core</artifactId>
<version>0.8.0-SNAPSHOT</version>
</dependency>
```
=== “Gradle”
```groovy epsilon 'org.eclipse.emfatic:org.eclipse.emfatic.core:0.8.0-SNAPSHOT' ```
A complete Gradle example that uses library.flexmi instead of (the XMI-based) library.model, and library.emf instead of library.ecore is shown below.
=== “build.gradle”
```groovy
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/flexmi-emfatic/build.gradle", true) }}}
```
=== “library.flexmi”
```xml
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/library.flexmi", true) }}}
```
=== “library.emf”
```emf
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/library.emf", true) }}}
```
The example below demonstrates using the generic epsilon.loadModel task to run the same EOL program against an Excel spreadsheet.
=== “build.gradle”
```groovy
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/excel/build.gradle", true) }}}
```
=== “mapping.xml”
```xml
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/excel/mapping.xml", true) }}}
```
Models conforming to the Eclipse UML2 metamodel can be queried as shown below.
=== “build.gradle”
```groovy
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/uml2/build.gradle", true) }}}
```
=== “uml.eol”
```eol
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/uml2/uml.eol", true) }}}
```
=== “model.uml”
```xml
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/uml2/model.uml", true) }}}
```
GenMyModel is a web-based modelling tool that can be used to create UML2-compliant models. You can consume the XMI representation of a public GenMyModel UML model directly from Epsilon as shown below.
=== “build.gradle”
```groovy
{{{ example("org.eclipse.epsilon.examples.workflow.standalone/uml2/genmymodel/build.gradle", true) }}}
```
If you would like to use an older (1.x) version of Epsilon, you can use this example instead, which uses a fat jar we used to produce (epsilon-1.x-kitchensink.jar) before moving all our jars to Maven Central/Sonatype.