tree: fe87c4becfac6212f734b19f69b22d3f424f3bb9 [path history] [tgz]
  1. src/
  2. about.html
  3. pom.xml
  4. README.md
papyrus-enforcer-rules/README.md

papyrus-enforcer-rules

Project Description

A Maven/Tycho project to add some validation rules for OSGI development. Most of the rules are pretty simple and are used to maintain coherence in a multi-plugin project.

How to build

This project is built using Maven. To build locally, simply execute the command line:

mvn clean install

How to use

Configuration to add in the pom.xml of your project:

<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-enforcer-plugin</artifactId>
			<version>${enforcer.api.version}</version>
			<dependencies>
				<dependency>
					<groupId>org.eclipse.papyrus</groupId>
					<artifactId>papyrus-enforcer-rules</artifactId>
					<version>0.0.1-SNAPSHOT</version>
				</dependency>
			</dependencies>
			<executions>
				<execution>
					<id>papyrus-enforce</id>
					<phase>validate</phase>
					<goals>
						<goal>enforce</goal>
					</goals>
					<configuration>
						<rules>
						</rules>
					</configuration>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

Rule 1 : org.eclipse.papyrus.tycho.enforcer.rules.CheckManifestParameter

Check that a specific field in the manifest.mf is equals to a predefined value Example : Check that Bundle-Localization is using the correct property file plugin

<myCustomRule implementation="org.eclipse.papyrus.tycho.enforcer.rules.CheckManifestParameter">
	<field>Bundle-Localization</field>
	<value>plugin</value>
</myCustomRule>

Rule 2 : org.eclipse.papyrus.tycho.enforcer.rules.RequireBundleVersion

Check that all required bundle have bundle-version set.

<myCustomRule implementation="org.eclipse.papyrus.tycho.enforcer.rules.RequireBundleVersion">
</myCustomRule>

Rule 3 : org.eclipse.papyrus.tycho.enforcer.rules.RequireBundleOrder

Check that required bundle are following a specific order. Parameter :

  • order : the expected order by namespace, all non listed namespace will be at the end
  • inverse : inverse the order, useful to pill up unreferenced namespace at the top

Example : Check that plugins starting by org.eclipse.ui are imported before plugins starting by org.eclipse.core

<myCustomRule implementation="org.eclipse.papyrus.tycho.enforcer.rules.RequireBundleOrder">
	<order>
		<namespace>org.eclipse.ui</namespace>
		<namespace>org.eclipse.core</namespace>
	</order>
	<inverse>false</inverse>
</myCustomRule>