Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

BPMN2-Modeler/DeveloperTutorials/Maven

Versions

This Tutorial was developed with Eclipse 4.5 (Mars) and BPMN2-Plugin version 1.2.0


Maven

The following tutorial describes how you can setup a BPMN2 extension project using the Maven build tool. This article asumes that you are familar with maven so we concentrate how to setup the project structure and how to configure the maven pom files. You can find the full source code of this maven example on GitHub.

To checkout the sources of the Eclipse BPMN2 plugin project see the Eclipse Git Repositories

The Project Structue

We want not only develop a BPMN2 Runtime extension, but also provide a eclipse feature and an update site to provide an installable plugin. Using maven makes the build process very easy even if the setup needs some more time as if you build your features and update site from the eclipse plugin wizzards.

As we want to provide the plugin with a feature and a site project the hole maven project structue looks like this:

|--bpmn2.tutorial/
| |--bpmn2.tutorial.feature/
| |--bpmn2.tutorial.plugin/
| |--bpmn2.tutorial.site/
| |--src/
| |--pom.xml

The parent pom in the project root provide all the general information and dependencies for the maven build process and describes the multi-module structure. The pom includes

  • definitions for the repositories of the BPMN2 Plugin
  • a set of profiles for the different Eclipse Versions (in this example Luna and Mars)
  • and the definition of the eclipse.tycho plugin which is used for the build process

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<prerequisites>
		<maven>3.0</maven>
	</prerequisites>


	<groupId>org.imixs.eclipse</groupId>
	<artifactId>bpmn2.tutorial</artifactId>
	<version>1.0.0-SNAPSHOT</version>
	<packaging>pom</packaging>
	<name>BPMN2 Runtime example</name>


	<licenses>
		<license>
			<name>GNU General Public License</name>
			<url>http://www.gnu.org/licenses/gpl-2.0.txt</url>
			<distribution>repo</distribution>
			<comments>All the results of the imixs workflow project are subject to the GPL licensing model. </comments>
		</license>
	</licenses>


	<properties>
		<eclipse-site>http://download.eclipse.org/releases/mars</eclipse-site>
		<platform-version>[4.4,5.0]</platform-version>
		<platform-version-name>mars</platform-version-name>
		<tycho-version>0.21.0</tycho-version>
		<tycho-extras-version>${tycho-version}</tycho-extras-version>
	</properties>

	<profiles>
		<profile>
			<id>platform-luna</id>
			<activation>
				<property>
					<name>platform-version-name</name>
					<value>luna</value>
				</property>
			</activation>
			<properties>
				<eclipse-site>http://download.eclipse.org/releases/luna</eclipse-site>
				<platform-version>[4.4,4.5)</platform-version>
				<platform-version-name>luna</platform-version-name>
			</properties>
		</profile>
		<profile>
			<id>platform-mars</id>
			<activation>
				<property>
					<name>platform-version-name</name>
					<value>mars</value>
				</property>
			</activation>
			<properties>
				<eclipse-site>http://download.eclipse.org/releases/mars</eclipse-site>
				<platform-version>[4.5,5.0]</platform-version>
				<platform-version-name>mars</platform-version-name>
			</properties>
		</profile>
		<profile>
			<id>platform-neon</id>
			<activation>
				<property>
					<name>platform-version-name</name>
					<value>neon</value>
				</property>
			</activation>
			<properties>
				<eclipse-site>http://download.eclipse.org/releases/neon</eclipse-site>
				<platform-version>[4.6,5.0)</platform-version>
				<platform-version-name>neon</platform-version-name>
			</properties>
		</profile>
	</profiles>

	<repositories>
		<repository>
			<id>eclipse-platform</id>
			<layout>p2</layout>
			<url>${eclipse-site}</url>
		</repository>

		<repository>
			<id>eclipse-bpmn2</id>
			<url>http://download.eclipse.org/modeling/mdt/bpmn2/updates/mars/1.2.0/</url>
			<layout>p2</layout>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
			<releases>
				<enabled>true</enabled>
			</releases>
		</repository>

		<repository>
			<id>eclipse-bpel</id>
			<url>http://download.eclipse.org/bpel/site/1.0.5</url>
			<layout>p2</layout>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
			<releases>
				<enabled>true</enabled>
			</releases>
		</repository>

		<repository>
			<id>eclipse-graphiti</id>
			<url>http://download.eclipse.org/graphiti/updates/milestones/</url>
			<layout>p2</layout>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
			<releases>
				<enabled>true</enabled>
			</releases>
		</repository>

		<repository>
			<id>eclipse-emf</id>
			<url>http://download.eclipse.org/modeling/emf/updates/releases/</url>
			<layout>p2</layout>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
			<releases>
				<enabled>true</enabled>
			</releases>
		</repository>

		<repository>
			<id>eclipse-gef</id>
			<url>http://download.eclipse.org/tools/gef/updates/releases/</url>
			<layout>p2</layout>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
			<releases>
				<enabled>true</enabled>
			</releases>
		</repository>

	</repositories>

	<pluginRepositories>

		<pluginRepository>
			<id>repo.eclipse.org.cbi-releases</id>
			<url>https://repo.eclipse.org/content/repositories/cbi-releases/</url>
		</pluginRepository>

		<pluginRepository>
			<!-- need maven-findbugs-2.3.2-SNAPSHOT, see http://jira.codehaus.org/browse/MFINDBUGS-122 
				remove this when this version is released -->
			<id>codehaus.snapshots</id>
			<url>http://snapshots.repository.codehaus.org/</url>
		</pluginRepository>

		<pluginRepository>
			<id>m2e-cbi</id>
			<url>http://download.eclipse.org/technology/m2e/maven/</url>
		</pluginRepository>
	</pluginRepositories>
	<build>
		<plugins>
			<!-- use JDK 1.6 settings for compiling -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-site-plugin</artifactId>
				<version>3.2</version>
				<configuration>
					<locales>en</locales>
					<reportPlugins>
						<plugin>
							<groupId>org.apache.maven.plugins</groupId>
							<artifactId>maven-project-info-reports-plugin</artifactId>
							<version>2.4</version>
							<!-- -->
							<reports>
								<report>index</report>
								<report>project-team</report>
								<report>license</report>
								<report>dependencies</report>
								<report>dependency-convergence</report>
								<report>plugin-management</report>
								<report>cim</report>
								<report>issue-tracking</report>
								<report>scm</report>
								<report>summary</report>
							</reports>
						</plugin>
					</reportPlugins>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.eclipse.tycho.extras</groupId>
				<artifactId>tycho-source-feature-plugin</artifactId>
				<version>${tycho-extras-version}</version>
				<executions>
					<execution>
						<id>source-feature</id>
						<phase>package</phase>
						<goals>
							<goal>source-feature</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<excludes>
						<plugin id="org.imixs.eclipse.bpmn2.source" />
					</excludes>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-p2-plugin</artifactId>
				<version>${tycho-version}</version>
				<executions>
					<execution>
						<id>attached-p2-metadata</id>
						<phase>package</phase>
						<goals>
							<goal>p2-metadata</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<excludes>
						<plugin id="org.imixs.eclipse.bpmn2.source" />
					</excludes>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-maven-plugin</artifactId>
				<version>${tycho-version}</version>
				<extensions>true</extensions>
			</plugin>

			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>target-platform-configuration</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<resolver>p2</resolver>
					<includePackedArtifacts>true</includePackedArtifacts>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-source-plugin</artifactId>
				<executions>
					<execution>
						<id>plugin-source</id>
						<goals>
							<goal>plugin-source</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>

		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.eclipse.tycho</groupId>
					<artifactId>maven-osgi-compiler-plugin</artifactId>
					<version>${tycho-version}</version>
					<configuration>
						<encoding>UTF-8</encoding>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-resources-plugin</artifactId>
					<version>2.4.1</version>
					<configuration>
						<encoding>ISO-8859-1</encoding>
					</configuration>
				</plugin>
				<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> 
					<version>1.3</version> </plugin> -->
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>findbugs-maven-plugin</artifactId>
					<version>2.3.2-SNAPSHOT</version>
					<configuration>
						<findbugsXmlOutput>true</findbugsXmlOutput>
						<failOnError>false</failOnError>
					</configuration>
					<executions>
						<execution>
							<goals>
								<goal>check</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-pmd-plugin</artifactId>
					<version>2.5</version>
					<configuration>
						<sourceEncoding>utf-8</sourceEncoding>
						<minimumTokens>100</minimumTokens>
						<targetJdk>1.5</targetJdk>
						<format>xml</format>
						<failOnViolation>false</failOnViolation>
					</configuration>
					<executions>
						<execution>
							<goals>
								<goal>cpd-check</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.eclipse.tycho</groupId>
					<artifactId>tycho-source-plugin</artifactId>
					<version>${tycho-version}</version>
					<configuration>
						<strictSrcIncludes>false</strictSrcIncludes>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
	<modules>
		<module>bpmn2.tutorial.plugin</module>
		<module>bpmn2.tutorial.feature</module>
		<module>bpmn2.tutorial.site</module>
	</modules>

	<url>https://github.com/rsoika/bpmn2-tutorial</url>
</project>

You can setup the groupID and artefactid of the maven project to your needs.

The plugin module

The subfolder bpmn2.tutorial.plugin includes the main java sources of your plugin project including the following files:

  • plugin.xml
  • plugin.properties
  • build.properties

These files are the standard eclipse arefacts for a plugin project. The content is described in other tutorials of this wiki. The pom.xml dos not include any additional configurations:

pom.xml:

<project
	xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.imixs.eclipse</groupId>
		<artifactId>bpmn2.tutorial</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</parent>

	<artifactId>bpmn2.tutorial.plugin</artifactId>
	<packaging>eclipse-plugin</packaging>
	<name>BPMN2 Tutorial</name>

</project>

The folder /src/ contains all the java sources of the plugin.

The feature module

The subfolder bpmn2.tutorial.feature includes the feature.xml file to configure the eclipse featue project. You can edit this file with the eclipse feature editor to add necessary information like the licence or copyright information. The section <requires> includes the plugin dependencies for the Eclipse BPMN2 modeler.

feature.xml:

<?xml version="1.0" encoding="UTF-8"?>
<feature
      id="bpmn2.tutorial.feature"
      label="BPMN2 Tutorial"
      version="1.0.0.qualifier"
      provider-name="www.imixs.org">
   <install-handler/>

   <description url="http://www.imixs.org">
      BPMN2 Tutorial
   </description>

   <requires>
      <import plugin="org.eclipse.bpmn2.modeler.core"/>
      <import plugin="org.eclipse.bpmn2.modeler.ui"/>
   </requires>

   <plugin
         id="bpmn2.tutorial.plugin"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

</feature>

The pom.xml file of the feature module again is quite simple and did not include any extra configuration:

pom.xml:

<project
	xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.imixs.eclipse</groupId>
		<artifactId>bpmn2.tutorial</artifactId>
		<version>1.0.0-SNAPSHOT</version>
		<!-- <relativePath>../pom.xml</relativePath> -->
	</parent>

	<artifactId>bpmn2.tutorial.feature</artifactId>
	<packaging>eclipse-feature</packaging>
	<name>BPMN2 Tutorial: Feature</name>
	<description>Main feature for BPMN2 Tutorial</description>
</project>

The updatesite module

The subfolder bpmn2.tutorial.updatesite includes the configuration for the generation of an update site. This project includes a category.xml file describing the structure of the update site and the included feature:

category.xml:

<?xml version="1.0" encoding="UTF-8"?>
<site>
   <description url="http://eclipse.org/bpmn2-modeler">
      BPMN2 Tutorial
   </description>
   <category-def name="bpmn2.tutorial" label="BPMN2 Tutorial">
      <description>
         BPMN2 Tutorial 
      </description>
   </category-def>
   
   <category-def name="bpmn2.tutorial.source" label="BPMN2 Tutorial Sources">
      <description>
         BPMN2 Tutorial Sources
      </description>
   </category-def>

   <feature url="features/bpmn2.tutorial.feature_0.0.0.jar" id="bpmn2.tutorial.feature" version="0.0.0">
      <category name="bpmn2.tutorial"/>
   </feature>
   
   <feature url="features/bpmn2.tutorial.source.feature_0.0.0.jar" id="bpmn2.tutorial.feature" version="0.0.0">
      <category name="bpmn2.tutorial.source"/>
   </feature>
</site>

You don't need to define the feature version number here because this is automatically updated by the maven build process. So the default version number "0.0.0" is used here.


The pom.xml file of the updatesite module now holds the confiugration of the eclipse.tycho plugin for the maven build process:

pom.xml:

<project
	xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.imixs.eclipse</groupId>
		<artifactId>bpmn2.tutorial</artifactId>
		<version>1.0.0-SNAPSHOT</version>
		<!-- 
		<relativePath>../pom.xml</relativePath>
		 -->
	</parent>

	<artifactId>bpmn2.tutorial.updatesite</artifactId>
	<packaging>eclipse-repository</packaging>
	<name>BPMN2 Tutorial: Update Site</name>
	<description>BPMN2 Tutorial</description>

	<properties>
	  <maven.antrun.plugin.version>1.3</maven.antrun.plugin.version>
	  <update.site.name>BPMN2 Tutorial</update.site.name>
	  <update.site.description>BPMN2 Tutorial Release build</update.site.description>
	  <target.eclipse.version>4.5 (Mars)</target.eclipse.version>
	  <siteTemplateFolder>siteTemplateFolder</siteTemplateFolder>
	</properties>

	<build>
		<plugins>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-packaging-plugin</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<format>'v'yyyyMMdd-HHmm</format>
					<archiveSite>true</archiveSite>
					<environments>
						<environment>
							<os>macosx</os>
							<ws>cocoa</ws>
							<arch>x86</arch>
						</environment>
						<environment>
							<os>win32</os>
							<ws>win32</ws>
							<arch>x86</arch>
						</environment>
						<environment>
							<os>linux</os>
							<ws>gtk</ws>
							<arch>x86</arch>
						</environment>
						<environment>
							<os>linux</os>
							<ws>gtk</ws>
							<arch>x86_64</arch>
						</environment>
					</environments>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>


The Build Process

To start the build process of your plugin run the maven install goal on the project root:

 mvn clean install

you can also specify a eclipse release as defined in the profiles of the pom.xml. See the following example to build the proejct for the Eclipse Neon release:

 mvn clean install -Pplatform-neon

Note: the profiles are defined in the parent pom.xml file.

The update site is created at the ~/target/repository folder of your update site module.

You'll have to manually copy it to your download server, or write a script to upload the udpate site automatically.

To run the plugin from the development environment you can simply open the plugin.xml file of your plugin module and click no 'Launch an Eclipse application in Debug mode' to use the build in launch mechanism of Eclipse for your plugin.

Back to the top