0
votes

In eclipse PDE( with EMF-IncQuery installed), if we have .eiq file and the corresponding .genmodel file just by refreshing it generates all the .java file and puts into src-gen package.

Just wondering If we could do the same through any maven plugin??

I have gone through https://wiki.eclipse.org/EMFIncQuery/UserDocumentation/Build where got the fair idea about how to generate java files from .genmodel but no info found about generating java files from .eiq files through EMF-IncQuery maven plug-in.

PF the concerned pom.xml entry

<!-- 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}/../abc.def.mnq.epackage.jar</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>
1

1 Answers

1
votes

The mentioned documentation page has an example pom.xml that also features the incquery-maven-compiler plugin, following the 'setting up the generator' comment.

The basic idea is that you should define the output folder, and select the EPackages your code used, and then the Maven compiler will generate the code.