Skip to content
Grégory Nain edited this page Jul 4, 2013 · 14 revisions

Welcome to the kevoree-modeling-framework wiki!

Last version : 1.3.1

The Kevoree Modeling Framework (KMF) is an alternate solution to the Eclipse Modeling Framework.

To get started with KMF, you just have to create a Maven project folder in which you will place the pom and your EcoreMM.

myProject
 |-metamodel
 | |-myMetaModel.ecore
 |-pom.xml

Then add this in your POM:

The plugin in the Build/Plugins section:

<plugin>    
 <groupId>org.kevoree.modeling</groupId>   
 <artifactId>org.kevoree.modeling.kotlin.generator.mavenplugin</artifactId>   
 <version>1.3.1</version>   
 <extensions>true</extensions>   
 <executions>   
  <execution>   
   <id>ModelGen</id>   
   <goals>   
    <goal>generate</goal>   
   </goals>
   <configuration>
    <!--Path to the ecore file-->
    <ecore>metamodel/myMetaModel.ecore</ecore>
    <!--Optional: if you want to add a package before the root package of your EcoreMM.
    Must be specified in dotted notation-->
    <!--
      <packagePrefix>org.myPrefix</packagePrefix>
    -->
    <!--Optional: specify where to generate the code. `./target/generated-sources/kmf` by default -->
    <output>./generatedCodeFolder</output>
    <!--Optional: set to true if you want to generate the model code only -->
    <modelOnly>false</modelOnly>
    <!--Optional: If true, generates JSON loader and serializer  -->
    <json>false</json>
    <!--Optional: If true, generates the modeling framework with JavaScript compatibility  -->
    <js>false</js>
    <!--Optional: If true, generates `findByQuery` methods. Only available for Java generation (no JavaScript)  -->
    <selector>false</selector>
   </configuration>
  </execution>
 </executions>
</plugin>

Add then the Kotlin compiler plugin

            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <!-- In case you selected the JavaScript option:
                    <execution>
                        <id>js</id>
                        <goals>
                            <goal>js</goal>
                        </goals>
                    </execution>
                    -->
                </executions>
            </plugin>

A little of Kotlin version property:

<properties>
 <kotlin.version>0.5.748</kotlin.version>
</properties>

The Kotlin library as a dependency

        <dependency>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-stdlib</artifactId>
            <version>${kotlin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains.intellij</groupId>
            <artifactId>annotations</artifactId>
            <version>117.157</version>
        </dependency>

Then cd into your project folder and just mvn clean install.

You're done :-)