Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » model.ecore is not generated in /model/impl during 'clean install' maven goal(model.ecore is not generated project\target\classes\package\gen\model\impl during maven 'clean install' goal)
model.ecore is not generated in /model/impl during 'clean install' maven goal [message #1839424] Sun, 21 March 2021 05:30 Go to next message
Palraj Jayaraj is currently offline Palraj JayarajFriend
Messages: 15
Registered: June 2015
Junior Member
Hello Everyone,
I'm trying to create a Maven emf project, which can be packaged into a standalone jar, so that other projects can use it.

What I have did so far:

  • Created a Maven project and created the ECore model and created it's genModel file.
  • Now, I would like to package this project into a jar, so, that other projects can work on it.
  • When I run the goal 'clean install' the jar file is being created.
  • when I add this artifact as dependency and try to access any model object, it get the below exception

Caused by: java.lang.RuntimeException: Missing serialized package: model.ecore
at model.impl.ModelPackageImpl.loadPackage(TSGPackageImpl.java:13231) ~[sample.model-1.0.0.jar:1.0.0]
at model.impl.ModelPackageImpl.init(ModelPackageImpl.java:2792) ~[sample.model-1.0.0.jar:1.0.0]
at model.ModelPackage.<clinit>(ModelPackage.java:60) ~[sample.model-1.0.0.jar:1.0.0]


While searching for that specific issue, I understood that the model.ecore file should be present under the model.impl package, from below links:


  • Whenever the 'clean install' goal is run in maven, the folder 'project\target\classes' is fully cleaned and the class files are generated. But, I could not find the model.ecore file in the 'project\target\classes\package\gen\model\impl' folder. is there a specific way I can generate so that mode.ecore, after cleaning?
  • When I try 'project-> clean project' in eclipse, then, the 'project\target\classes' is fully cleaned and the class files along with mode.ecore files are generated.
  • is some EMF builder is not run during the 'clean install' goal?
  • Could someone point a way to generate the model.ecore file, during 'clean install' goal?


The project's pom.xml:
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.4.0</version>
</parent>
<packaging>jar</packaging>
<artifactId>sample.model</artifactId>

<dependencies>
    <!-- Emf dependencies -->
    <dependency>
        <groupId>org.eclipse.emf</groupId>
        <artifactId>org.eclipse.emf.common</artifactId>
        <version>2.15.0</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.emf</groupId>
        <artifactId>org.eclipse.emf.ecore</artifactId>
        <version>2.15.0</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.emf</groupId>
        <artifactId>org.eclipse.emf.ecore.xmi</artifactId>
        <version>2.15.0</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.emf</groupId>
        <artifactId>org.eclipse.emf.ecore.change</artifactId>
        <version>2.13.0</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.emf</groupId>
        <artifactId>org.eclipse.emf.edit</artifactId>
        <version>2.14.0</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot</artifactId>
    </dependency>
</dependencies>

I have raised the same question in the stackoverflow. Please, provide me some pointers:

Thanks,
Palraj
Re: model.ecore is not generated in /model/impl during 'clean install' maven goal [message #1839425 is a reply to message #1839424] Sun, 21 March 2021 05:45 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You probably want to ask on the Xtext group since keeping the auto-generated model.ecore in the "src" tree is a deviation from the EMF practice of keeping it in the "model" folder.

Personally I always use an EMF standard manually maintained *.ecore in the "model" folder with Xtext and so have fewer packaging issues. You may need special declarations to copy *.ecore resources.

Regards

Ed Willink
Re: model.ecore is not generated in /model/impl during 'clean install' maven goal [message #1839426 is a reply to message #1839425] Sun, 21 March 2021 06:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Is the model.ecore present in src folder adjacent to the ModelPackageImpl.java class? I guess it's a really huge model, right?

It sounds like in some cases the model.ecore not copied to the bin (target/classes) folder. Perhaps you have to tell Maven explicitly to copy *.ecore resources.

https://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: model.ecore is not generated in /model/impl during 'clean install' maven goal [message #1839441 is a reply to message #1839426] Sun, 21 March 2021 15:58 Go to previous messageGo to next message
Palraj Jayaraj is currently offline Palraj JayarajFriend
Messages: 15
Registered: June 2015
Junior Member
Thanks Ed for the reply.
Yes, It is a huge model. Yes, I have both the model.ecore and model.genmodel adjacent to the source folder, under a folder named 'models'. When I use the eclipse IDE to build the project, the eclipse builder mechanism copies the model.ecore to the package where ModelPackageImp.class is present. Yes, it is present there, when eclipse build is run. But, when Maven clean install is triggered, this model.ecore is not present under the bin folder.

I was confused by this behaviour of model.ecore not getting copied to the package folder of 'ModelPackageImp.class' file, when the binary is built using maven goals.

Is it the same model.ecore ( which I have adjacent to the source folder), that needs to be copied to the package of ModelPackageImp.class file, by myself during maven building?
Re: model.ecore is not generated in /model/impl during 'clean install' maven goal [message #1839442 is a reply to message #1839425] Sun, 21 March 2021 16:05 Go to previous messageGo to next message
Palraj Jayaraj is currently offline Palraj JayarajFriend
Messages: 15
Registered: June 2015
Junior Member
Thanks Ed for the reply.
I have both the model.ecore and model.genmodel adjacent to the source folder, under a folder named 'models'. since it is a huge mode, the EMF needs the model.ecore to be present in the ModelPackageImpl.class package, in the jar file for it to work. When a eclipse build is triggered, this model.ecore is copied by the eclipse builders somehow to the package, under bin folder. But, when maven build is run, this is not happening? so, is there a way to specify maven to build/copy this model.ecore to the package where ModelPackageImpl.class is present?
Thanks,
Palraj
Re: model.ecore is not generated in /model/impl during 'clean install' maven goal [message #1839443 is a reply to message #1839442] Sun, 21 March 2021 16:39 Go to previous message
German Vega is currently offline German VegaFriend
Messages: 104
Registered: December 2015
Location: Grenoble, France
Senior Member
In maven, you can copy resources explicitly using the copy-resources plugin , see :

https://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html
Previous Topic:Use .jar as Xtext resource
Next Topic:Unresolved requirement after building CDO server plugin manually
Goto Forum:
  


Current Time: Fri Apr 26 01:02:32 GMT 2024

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

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

Back to the top