Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Xcore] Standalone app generates EJavaObject types (Standalone generation of .ecore file always generates EJavaObject types)
[Xcore] Standalone app generates EJavaObject types [message #1835598] Tue, 08 December 2020 07:23 Go to next message
Miguel Jimenez is currently offline Miguel JimenezFriend
Messages: 40
Registered: July 2015
Member
Last year I created a demo application using gradle to generate the .ecore and .genmodel files from an Xcore model. You can find that app here:

https://github.com/jachinte/xcore-gradle-example

To generate those files, run "gradle xcoreExport". It will run a custom task (ExportXcoreTask.java) and generate the files in "model-gen". Since .ecore and .genmodel files are not ignored, you can find the original <generated> files in the repository.

When I run the custom task now, the types are always EJavaObject, but it worked well before (See Example.ecore).

My two questions:

1. Since I'm using specific versions of the dependencies, why is the app not generating the correct types anymore?
2. How do I fix the custom task, so that it generates the correct types? I tried many many things but none worked.

Thank you,
Miguel

This is the base code in the task:

        new StandaloneSetup().setPlatformUri("./");
        final Injector injector = new XcoreStandaloneSetup()
            .createInjectorAndDoEMFRegistration();
        final XtextResourceSet set =
            injector.getInstance(XtextResourceSet.class);
        set.addLoadOption(
            XtextResource.OPTION_RESOLVE_ALL,
            Boolean.TRUE
        );
        final URI uri =
            URI.createFileURI(this.xcoreInputFile.getAbsolutePath());
        final ResourceSet rset = new ResourceSetImpl();
        rset.getURIConverter()
            .getURIMap()
            .putAll(EcorePlugin.computePlatformURIMap(true));
        final Resource input = rset.getResource(uri, true);
        input.load(Collections.EMPTY_MAP);
        EcoreUtil.resolveAll(input);


After the last line, the "input" resource has two errors:

XtextLinkingDiagnostic: null:1 Ecore cannot be resolved.
XtextLinkingDiagnostic: null:2 GenModel cannot be resolved.

[Updated on: Tue, 08 December 2020 07:36]

Report message to a moderator

Re: [Xcore] Standalone app generates EJavaObject types [message #1835606 is a reply to message #1835598] Tue, 08 December 2020 15:34 Go to previous message
Miguel Jimenez is currently offline Miguel JimenezFriend
Messages: 40
Registered: July 2015
Member
Never mind, it seems that the problem is gradle 6 (perhaps it's something related to the daemon and how it compiles the project). Using gradle 5.3 works.
Previous Topic:Two different XML custom serializations for the same model
Next Topic:Question about generation with xsd
Goto Forum:
  


Current Time: Mon Apr 19 00:58:15 GMT 2021

Powered by FUDForum. Page generated in 0.01901 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top