Running Acceleo from within Sirius

175 Views Asked by At

I am trying to run a simple Acceleo generation pragmatically from within a Java Services class of my Sirius Viewpoint Specification Project. I can run the Acceleo mtl from 'Run Configuration' and it works fine but When i try to do it from Java Servies Class inside Sirius Viewpoint Specification project it doesn't work. I am using Generate.java (created by Acceleo for my generate.mtl file) to run it as under:-

URI modelURI = URI.createFileURI("C:/Users/Aon/runtime-EclipseApplication/fsys/My.fsys");

File targetFolder = new File("C:/Users/Aon/runtime-EclipseApplication/fsys.acceleo.module.sample/tasks");

Generate generator = new Generate(uri, targetFolder, Collections.emptyList());
generator.doGenerate(null);

Can anyone guide me what about how to go about it? Thanks

UPDATE

Hi, thanks for the response. Ilve further tried to resolve this.Let me add a few more details for clarity .

  1. I've created a simple metamodel in Eclipse named fsys (for file system). A parent class composing 2 classes Files and Folders.
  2. I then generated edit and editor code and launched a runtime configuration.
  3. In runtime i created 3 projects. a) a modeling project within which i created an instance of my mode called my.fsys b) an acceleo project that takes this model and creates a basic text file (I tested it with Acceleo generation and it works fine) c) I created a Sirius Viewpoint specification project and using its Java Services method I want to access the Acceleo Java launcher class (that it auto created from the MTL file) by calling its main method.
  4. I added the Acceleo project as dependency in the build path of the sirius project.
  5. Now when i run the service, it gives an error that it cannot find my model (my.fsys).
  6. If i am using native eclipse project i shouldnt need to register the packages again after adding them to dependencies so why does it give an error?
  7. I am unable to launch the debugger from the runtime for Siriu's Java Service class.
Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException:
 Package with uri 'http://www.example.org/fsys' not found. (file:/C:/Users/Aon/runtime-EclipseApplication/filnfol/My.fsys

project details

0

There are 0 best solutions below