Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XMI Files: Referencing Metamodel from Classpath
XMI Files: Referencing Metamodel from Classpath [message #1587304] Tue, 27 January 2015 09:02
Jamie Astin is currently offline Jamie AstinFriend
Messages: 1
Registered: January 2015
Junior Member
Hello everyone,

I am relatively new to the EMF community, and was hoping someone could provide some insight into my problem.

I am producing an Xpand project, which will be distributed as part of a framework. I will be shipping a JAR to other people who wish to consume this framework. It is intended that within this JAR I will provide the metamodel in ecore format, and the relevant Xpand files (xpt, Checks.chk and Extensions.ext).

Consuming projects will then simply need to implement the metamodel in a XMI file, and have a mwe2 file which describes how to invoke the code generator.

Working with the example project, I am envisaging the following:


consuming-project (Eclipse Project)

Looking at the Model.xmi file that is created with the sample project, the reference from the XMI model to the underlying metamodel seems to be established in the root tag:

<metamodel:Model xmi:version="2.0" 
    xsi:schemaLocation="// metamodel/metamodel.ecore">

As far as I can establish, this is being facilitated by the relative path 'metamodel/metamodel.ecore'.

If I have both the "modelling-framework" and "consuming-project" as two eclipse projects in the same workspace, I can change this relative path to:

NOTE: I've had to remove the "http" protocol from the URLs to prevent the Forum software from rejecting my post. D'oh!


This use of "classpath:/metamodel/metamodel.ecore" is successful. However, if I only have "consuming-project" in my workspace, and reference a built jar of "modelling-framework", I receive the following error:

Couldn't find resource on classpath : classpath:/metamodel/metamodel.ecore

I have checked the built jar file, and I can confirm that the ecore file is present at the specified path. In fact, the following code (in the "consuming-project" yeilds a JarURLConnection:


Is there some magic to refer to a metamodel from within a JAR file?

Any pointers would be greatly appreciated,


Previous Topic:do I have the correct download for the EMF plugin
Next Topic:EMF Validation with specific target Class and Java 8
Goto Forum:

Current Time: Wed Feb 26 20:59:56 GMT 2020

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

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

Back to the top