Skip to main content
Jump to: navigation, search

Difference between revisions of "VIATRA/UserDocumentation/Build"

(Repository)
Line 18: Line 18:
 
# '''org.eclipse.incquery:incquery-patternlanguage''' - dependency for the IncQuery with support for generic API (requires many more dependencies - only use if required)
 
# '''org.eclipse.incquery:incquery-patternlanguage''' - dependency for the IncQuery with support for generic API (requires many more dependencies - only use if required)
 
# '''org.eclipse.incquery:incquery-maven-plugin''' - maven code generator
 
# '''org.eclipse.incquery:incquery-maven-plugin''' - maven code generator
 +
 +
<source lang="xml">
 +
<properties>
 +
<incquery.version>0.8.0</incquery.version>
 +
</properties>
 +
 +
<dependencies>
 +
<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.incquery</groupId>
 +
<artifactId>incquery-maven-plugin</artifactId>
 +
<version>${incquery.version}</version>
 +
</dependency>
 +
</dependencies>
 +
 +
<repositories>
 +
<repository>
 +
<id>incquery</id>
 +
<url>https://repo.eclipse.org/content/groups/emf-incquery/</url>
 +
</repository>
 +
</repositories>
 +
</source>
  
 
== incquery-maven-plugin ==
 
== incquery-maven-plugin ==

Revision as of 17:31, 11 December 2014

Maven integration

Version 0.8.0 of EMF-IncQuery supports building IncQuery projects in a Maven-based builds by generating the pattern matcher code from the eiq files.

Known limitations:

  • bug 434794 - Code generation for integration components (e.g. validation framework, derived features) is not supported.
  • bug 443715 - Maven compiler does not work if EMF code is in the same project as the queries.
  • The EMF-IncQuery project is not available from Maven Central.
  • There is no maven archetype support: it is not possible to generate an eclipse-less project automatically, that works with IncQuery. However, manually created projects can be built with the existing compiler.

Repository

Maven components are available from the Eclipse maven repository with the following url: https://repo.eclipse.org/content/groups/emf-incquery/

It includes both snapshot and release versions.

The following three maven-projects should be used:

  1. org.eclipse.incquery:incquery-runtime - dependency for the IncQuery runtime, without support for generic API
  2. org.eclipse.incquery:incquery-patternlanguage - dependency for the IncQuery with support for generic API (requires many more dependencies - only use if required)
  3. org.eclipse.incquery:incquery-maven-plugin - maven code generator
	<properties>
		<incquery.version>0.8.0</incquery.version>
	</properties>
 
	<dependencies>
		<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.incquery</groupId>
			<artifactId>incquery-maven-plugin</artifactId>
			<version>${incquery.version}</version>
		</dependency>
	</dependencies>
 
	<repositories>
		<repository>
			<id>incquery</id>
			<url>https://repo.eclipse.org/content/groups/emf-incquery/</url>
		</repository>
	</repositories>

incquery-maven-plugin

The maven plugin requires information from the used EMF packages and additionally the EMF packages should be able loaded as well. For this reason, it is important to add references to EPackages and Genmodels together with the corresponding dependencies.

Example generator (based on school example):

<!-- Using maven-clean-plugin to remove previously generated code -->
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-clean-plugin</artifactId>
  <version>2.5</version>
  <executions>
    <execution>
      <phase>clean</phase>
      <goals>
        <goal>clean</goal>
      </goals>
      <configuration>
        <filesets>
          <fileset>
            <!-- Generated code folder -->
            <directory>src-gen</directory>
            <includes>
              <include>**/*</include>
            </includes>
          </fileset>
        </filesets>
      </configuration>
    </execution>
  </executions>
</plugin>
<!-- Setting up generator -->
<plugin>
  <groupId>org.eclipse.incquery</groupId>
  <artifactId>incquery-maven-plugin</artifactId>
  <version>0.8.0</version>
  <!-- Binding execution to the code generation lifecycle phase -->
  <executions>
    <execution>
      <goals>
        <goal>generate</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <!-- Output directory - required -->
    <outputDirectory>src-gen</outputDirectory>
      <metamodels>
        <metamodel>
          <!-- Java class for the EMF EPackage -->
          <packageClass>school.SchoolPackage</packageClass>
          <!-- genmodel file used for generating the EMF model classes -->
          <genmodelUri>../school/model/school.genmodel</genmodelUri>
        </metamodel>
      </metamodels>
  </configuration>
  <dependencies>
    <!-- Dependency required for the school project (that contains the generated EPackage) -->
    <dependency>
      <groupId>org.eclipse.incquery</groupId>
      <artifactId>school</artifactId>
      <version>0.8.0</version>
    </dependency>
  </dependencies>
</plugin>

Back to the top