Skip to content

New IDE Plugin Tutorial

Luis Diogo Couto edited this page May 29, 2015 · 1 revision

A complete guide guide will be written at some point. For now, here's a quick tutorial on integrating core modules and their IDE plug-ins. Please note that "core" has nothing to do with the functionality itself. It just means a pure java program with no Eclipse/IDE stuff

This guide assumes you have the following...

  • A core module that is built with Maven and has no Eclipse dependencies
  • An Eclipse/Overture IDE plug-in that will provide a UI for your core module
  • Minimal working knowledge of poms, manifests and their associated terminology

... and will teach you how to connect the two.

Dependency management in projects that use both Maven and Eclipse is a bit tricky (long story. Go look up Eclipse Tycho). Our approach is to completely detach the core and build it with Maven and then use jar copying to make them accessible on the Eclipse side. The steps to do this are described below.

1.Build the core module with maven

This is pretty straightforward. cd into the module folder and type mvn install. You can also build the entire Overture core, if the module is part of it.

2. Copy the core module into the plug-in

In this step, we will instruct maven to copy a jar of the core module into the respective IDE plug-in. This will then allow the IDE to access it. Edit the pom.xml of the IDE plug-in to add the following:

 <build>
    <plugins>
      <plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-dependency-plugin</artifactId>
	<executions>
	  <execution>
	    <id>copy-dependencies</id>
	    <phase>process-sources</phase>
	    <goals>
	      <goal>copy</goal>
	    </goals>
            <configuration>
              <outputDirectory>${basedir}/jars</outputDirectory>
              <overWriteReleases>true</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
              <stripVersion>true</stripVersion>
              <artifactItems>
                <artifactItem>
                  <groupId>org.ovt.core</groupId>
                  <artifactId>example</artifactId>
                  <version>${project.version}</version>
                </artifactItem>
              </artifactItems>
	    </configuration>
	  </execution>
	</executions>
      </plugin>
      <plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-clean-plugin</artifactId>
	<configuration>
          <failOnError>false</failOnError>
	  <filesets>
	    <fileset>
	      <directory>${basedir}/jars</directory>
	      <followSymlinks>false</followSymlinks>
	    </fileset>
	  </filesets>
	</configuration>
      </plugin>
    </plugins>

The first block (copy-dependencies) does the actual copying. The second (maven-clean-plugin) will ensure that the jar gets deleted when you run mvn clean.

Now, you need to build the IDE plug-in. cd into it and type mvn install. Alternatively, build the entire Overture IDE, if the plug-in is a part of it. This should copy the jar into the jars folder of your plug-in. Check that it's there before proceeding.

3. Access the core module from the plug-in

Now, we need to make the plug-in aware of the jar. This is done by editing the manifest file (META-INF/MANIFEST.MF) and adding the following to it:

Bundle-ClassPath: .,
 jars/example.jar

And that's it. You should now be able to access the packages of the core module from the IDE plug-in. You may have to use the Maven > Update functionality of Eclipse.

One final and important note: if you make changes to the core module, in order to see them in the IDE plug-in, you must rebuild both the core module and the IDE plug-in in Maven. This is due to the fully detached build system we are using.