Chapter 4. Embedding Kermeta code in an Eclipse plugin

This tutorial aims to show how to embedd kermeta code in an Eclipse plugin. It also shows how to add some java code that is able to initialize and call the kermeta code in Eclipse context.

Due to the requirement of OSGI deployment used by eclipse. The simple packaging strategy used in the previous chapter isn't enough. Some special care is required while packaging the code.

TODO

4.1. Presentation/key points

This tutorial will detail two scenarii:

  1. the Kermeta code must be exposed to and used by several plugins

  2. the Kermeta code is used by a single plugin and can be privatly used by it

Kermeta plugin needing to be exposed to several plugins

  1. Create a new Kermeta project

  2. Configure the project and a pom.xml that is able to take into account both Kermeta code and some java code that is able to generate an OSGI compatible jar file

    The current recommanded way is to use maven-bundle-plugin.

  3. Add some java code that initialize the kermeta code and expose some operations of the kermeta code as a simplified API

    Add some java code that redirect kermeta StdIO messages to a dedicated eclipse console

  4. Create a plugin project that will use it. (for example an user interface)
  5. Deploy and execute the plugins in an eclipse runtime workbench

    Currently, the recommanded way to deploy the plugins is to use the OSGI provisionner

    tips about how debugging

The tutorial also presents an alternative packaging that ease eclipse UI debugging: the UI plugin directly embedds the kermeta jar

Kermeta code is used by a single plugin and is privatly used by it. The kermeta code is compiled using eclipse and the simple pom.xml

  1. Create an eclipse plugin

  2. Automate the copy of the jar produced from the kermeta project to an internal lib folder: with eclipse ant builder

  3. configure the plugin to use the jar

    update the dependencies according to the one computed from the kermeta jar

  4. Create a plugin project that will use it. (for example an user interface)
  5. Deploy and execute the plugins in an eclipse runtime workbench with the classic eclipse approeches

  6. Use of a tycho driven pom.xml to automate the build of such plugin (use copy-dependency to grab the kermeta jar as a precompile step)

Alternative, The tutorial also presents an alternative packaging that ease eclipse UI debugging: the UI plugin directly embedds the kermeta jar, the Kermeta code is fully compiled using maven

Kermeta code is used by a single plugin and is privatly used by it

  1. Create an eclipse plugin

  2. Automate the copy of the jar produced from the kermeta project to an internal lib folder: with eclipse ant builder

  3. configure the plugin to use the jar

    update the dependencies according to the one computed from the kermeta jar

  4. Create a plugin project that will use it. (for example an user interface)
  5. Deploy and execute the plugins in an eclipse runtime workbench with the classic eclipse approeches

  6. Use of a tycho driven pom.xml to automate the build of such plugin (use copy-dependency to grab the kermeta jar as a precompile step)