|
|
|
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 16:15   |
Eclipse User |
|
|
|
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.32693 seconds