|
|
Re: How to generate java files from inc query definition file (.eiq files) [message #1715877 is a reply to message #1715840] |
Fri, 27 November 2015 06:37 |
bisoyi J Messages: 12 Registered: September 2014 |
Junior Member |
|
|
I highly appreciate the reply.
Yes PF the pom.xml entry for generation for java files as below:
<properties>
<xtend.compiler.version>2.8.1</xtend.compiler.version>
</properties>
<repositories>
<repository>
<id>repo.eclipse.org</id>
<url>https://repo.eclipse.org/content/groups/releases/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.eclipse.org</id>
<url>https://repo.eclipse.org/content/groups/releases/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0.4</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
<version>2.9.1.v20130827-0309</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtend</groupId>
<artifactId>org.eclipse.xtend.lib</artifactId>
<version>${xtend.compiler.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
<artifactId>org.eclipse.core.resources</artifactId>
<version>3.7.100</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.codegen.ecore</artifactId>
<version>2.9.1-v20140203-1126</version>
</dependency>
<dependency>
<groupId>org.eclipse.incquery</groupId>
<artifactId>incquery-runtime</artifactId>
<version>${incquery.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.incquery</groupId>
<artifactId>incquery-patternlanguage</artifactId>
<version>${incquery.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<version>${xtend.compiler.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Setting up generator -->
<plugin>
<groupId>org.eclipse.incquery</groupId>
<artifactId>incquery-maven-plugin</artifactId>
<version>1.0.1</version>
<!-- Binding execution to the code generation lifecycle phase -->
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- Output directory - required -->
<outputDirectory>${project.build.directory}/../src-gen</outputDirectory>
<metamodels>
<metamodel>
<!-- Java class for the EMF EPackage - use this if generated EMF code is in the classpath
<packageClass>${project.build.directory}/..</packageClass> -->
<!-- genmodel file used for generating the EMF model classes - use this if EMF model is in the same project -->
<genmodelUri>${project.build.directory}/../XYZ.genmodel</genmodelUri>
</metamodel>
</metamodels>
</configuration>
</plugin>
</plugins>
</build>
I have Basically the XYZ.genmodel and XYZ.ecore but DO NOT have the Epackage as mentioned the wiki page.
Do I have to create the Epackages (.java files)somehow to provide the input or the .genmodel + .ecore would be enough to generate the src-gen from .eiq files?
May be I have to dig down and provide the corresponding EPackage java files only because providing the .jar file (containing the EPackage class ) gives "Execution failed due to wrong classname" error.
Or is the question would be more appropriate to ask how to get the referenced EPackage class from the .eiq file. Sorry I put multiple questions in a single post.;(
Thanks for the response again!
[Updated on: Fri, 27 November 2015 09:48] Report message to a moderator
|
|
|
Re: How to generate java files from inc query definition file (.eiq files) [message #1715929 is a reply to message #1715877] |
Fri, 27 November 2015 21:15 |
Zoltan Ujhelyi Messages: 392 Registered: July 2015 |
Senior Member |
|
|
Hi,
if I understand you correctly, you have managed to create an .ecore and a .genmodel file for your metamodel, but don't have its generated code available (not related to EMF-IncQuery at all; I am talking about the generated model code from EMF). If you are the creator of the metamodel, you should open the .genmodel file, and execute code generation from it (see the following tutorial for details: http://www.vogella.com/tutorials/EclipseEMF/article.html#emfmodel); if you are using an existing metamodel, it plug-in should also include the EPackage implementation.
Example: I want to reuse the UML metamodel implementation from EMF provided by the org.eclipse.uml2.uml plugin, I have to add the dependency to the defining plug-in, and refer to the EMF-generated UMLPackage class (and I have to duplicate the dependency here, as this Maven plug-in cannot reuse the dependencies from manifest.mf).
<plugin>
<groupId>org.eclipse.incquery</groupId>
<artifactId>incquery-maven-plugin</artifactId>
<version>${incquery.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>src-gen</outputDirectory>
<metamodels>
<metamodel>
<packageClass>org.eclipse.uml2.uml.UMLPackage</packageClass>
</metamodel>
</metamodels>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.uml2</groupId>
<artifactId>org.eclipse.uml2.uml</artifactId>
<version>5.0.1.v20140910-1354</version>
</dependency>
</dependencies>
</plugin>
Almost always this is the recommended way to refer to metamodels for the maven-compiler. The single notable exception to this rule is the case when both the metamodel and the patterns are specified in the same project. In that case, adding a reference to the .genmodel file would do the trick required.
---
One more thing: the EMF-IncQuery generator _expects_ the generated metamodel code from EMF to be available during runtime, it does not generate it. If you are the provider of this code, you could either upload it to the repository, or use something like the maven snippet from https://gist.github.com/hwellmann/6044835
Cheers,
Zoltán
|
|
|
|
Powered by
FUDForum. Page generated in 0.03604 seconds