model.ecore is not generated in /model/impl during 'clean install' maven goal [message #1839424] |
Sun, 21 March 2021 05:30 |
Palraj Jayaraj 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 #1839441 is a reply to message #1839426] |
Sun, 21 March 2021 15:58 |
Palraj Jayaraj 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 |
Palraj Jayaraj 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03333 seconds