I need to headlessly run some Epsilon workflows, and am running into some difficulties. I've used the epsilon-ant-standalone.jar and org.eclipse.epsilon.workflow.emf.jar to get hold of Epsilon and the ANT tasks. Note: the EMF workflow project was missing a task definition file, so I have created one - remind me to send you a patch.

I've also packaged up my own plugins and EOL scripts into a jar file - I can execute both EOL and the Java code fine. However.. the jar also contains some Ecore models and associated generated code. I'm not sure how to register the EPackages from my jar file, and so am having trouble creating models.

Initially, I thought it would be fine to simply register the Ecore models using the epsilon.emf.register task and use the reflective API:

<epsilon.emf.register file="foo.ecore"/>

This is fine up to the point where one of my EOL scripts passes a model object to a custom Java tool which is expecting an object conforming to a particular model class, but instead gets a DynamicEObject, which it is unable to cast to the actual class.

So instead I tried to define a Java class for ANT to execute in order to register my EPackages with the registry before creating the models. Sadly, this does not work.

I've uploaded a zip here: http://jamesrobertwilliams.co.uk/tmp/epsilon-workflow-cmd.zip In build.xml you can see the call to Java to register the metamodel before loading the model. If you run build.xml, it should crash due to not finding the appropriate EPackage when loading the model. If you uncomment the <epsilon.emf.register..> line, it should run the EOL module, but throw a ClassCastException when executing the tool.

Also: a note to anyone attempting to do similar, if you want to reference Epsilon modules stored in jars, you need to define your imports as follows:

Replacing it with the following seems to be solving this problem (I'm getting an NPE at at jw.fighter.players.fantastic.FantasticBot.findOrCreateCharacteristic[FantasticBot.java:74] but I guess that's a different story)