Preparing Maven Compatibility

Petals ESB is a platform built with Apache Maven.
Among all the tools that come with Petals, there is a Maven plug-in for Petals, called the Petals Maven plug-in.

Components projects

For the moment, component projects can only be created with the Petals Maven plug-in.
They can then be converted into an Eclipse project using the command

mvn eclipse:eclipse

... before being imported in the work space.


Petals Studio provides a wizard to create Petals components, but it uses the Petals Maven plug-in to create them.
There is no specific support of Maven in the studio for component projects.
The compatibility is the native one between Maven and Eclipse.

Service-Unit and Service Assembly projects

Things are different for SU and SA projects.
Indeed, SU and SA projects can only be created from the studio.
But that does not prevent these projects from being compatible with Maven.

Service-Unit projects

When you create a SU project in the studio, it is compatible with the Petals Maven plug-in.
The file hierarchy is a Maven one (src/main/...). And a complete pom.xml is generated.

Here is a sample pom.xml generated for a provides SU targeting the SOAP component.

<?xml version="1.0"?>
<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/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>
	 <!--
	<parent>
		<artifactId></artifactId>
		<groupId></groupId>
		<version></version>
	</parent>
	 -->

	<name>su-SOAP-TuxDroid-provide</name>
	<artifactId>su-SOAP-TuxDroid-provide</artifactId>
	<groupId>org.ow2.petals</groupId>
	<version>1.0-SNAPSHOT</version>
	<packaging>jbi-service-unit</packaging>
	<description></description>

	<dependencies>
		<dependency>
			<groupId>org.ow2.petals</groupId>
			<artifactId>petals-bc-soap</artifactId>
			<version>4.0</version>
			<scope>provided</scope>
			<type>jbi-component</type>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.ow2.petals</groupId>
				<artifactId>maven-petals-plugin</artifactId>
				<version>2.1.2</version>
				<extensions>true</extensions>
				<configuration>
					<updateJBIXml>true</updateJBIXml>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Notice that there is no defined parent.
To customize the generated POM, please read the preferences section.

Service Assembly projects

When you create a SA project in the studio, it is compatible with the Petals Maven plug-in.
The file hierarchy is a Maven one (src/main/...). And a complete pom.xml is generated.

Here is a sample pom.xml generated for a SA project.

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>
	 <!--
	<parent>
		<artifactId></artifactId>
		<groupId>org.ow2.petals</groupId>
		<version>1.0-SNAPSHOT</version>
	</parent>
	 -->

	<name>sa-BPEL-NewProcess-provide</name>
	<artifactId>sa-BPEL-NewProcess-provide</artifactId>
	<groupId>org.ow2.petals</groupId>
	<version>1.0-SNAPSHOT</version>
	<packaging>jbi-service-assembly</packaging>
	<description></description>

	<dependencies>

	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.ow2.petals</groupId>
				<artifactId>maven-petals-plugin</artifactId>
				<version>2.1.2</version>
				<extensions>true</extensions>
				<configuration>
					<updateJBIXml>true</updateJBIXml>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Notice that there is no defined parent.
To customize the generated POM, read the preferences section.


A SA project that references SU projects should depend on their Maven artifacts.
It means the dependencies should list the Maven artifacts which correspond to the referenced service-units.
When you build a SA project by hand, it is your responsibility to update the dependencies.


However, it is possible to update the SA's POM automatically when its jbi.xml is modified.
An option is available in the preferences.


However, when you import an existing service assembly, or more generally, when you generate a set of SU and SA projects, the dependencies section is filled-in automatically. It is planned to complete the tooling to update automatically the SA dependencies.

To summer up the question about Maven dependencies between SU and SA projects:

1. If the SU and SA projects are generated (e.g. service assembly import), the dependencies are set automatically.
2. If the SU and SA projects are built by hand or edited, then you have to update the SA dependencies in its pom.xml.

The second point can be made automatic through the preferences.

Preferences for Maven

There are preferences to customize the generated pom.xml files.
Go into Window > Preferences and select Petals > Maven.

The Petals Maven plug-in

The following elements can be changed in these preferences.

  • Plugin Version: the version of the Petals Maven plug-in.
  • Group ID: the group ID for all the Maven projects, org.ow2.petals by default.
  • POM parent: the URL of a pom.xml file. When provided, the parent attributes are written in the generated pom.xml files.

These preferences apply for both SU and SA projects.

POM customization

It is possible to generate different POM files for both SU and SA projects.

  • Use default POM is to be used only if the usual POM are good enough.
  • Use customized POM is an option to provide a directory containing a set of templates for POM files.


There are 3 kinds of possible templates:

  • sa-default-pom.xml is the default POM for all the SA projects. This file is required and equivalent to the default POM.
  • su-default-pom.xml is the default POM for all the SU projects that do not have a component template. This file is required and equivalent to the default POM.
  • <component_name>_su_pom.xml is a POM template for a SU project associated with this component.

As an example, "petals-bc-soap_su_pom.xml" will be used for all the SU projects that target the Petals SOAP component.
The default templates can be generated in the given directory by clicking Generate the default POM templates.


The following variables are available for the templates:

Variable Description
${PETALS_ParentArtifactId} The artifact ID of the parent.
${PETALS_ParentGroupId} The group ID of the parent.
${PETALS_ParentVersion} The version of the parent.
${PETALS_Name} The value of the name element in the POM.
${PETALS_ArtifactId} The artifact ID.
${PETALS_GroupId} The group ID.
${PETALS_Version} The version.
${PETALS_Description} The value of the description element in the POM.
${PETALS_ComponentName} The name of the target component.
${PETALS_ComponentVersion} The version of the target component.
${PETALS_PetalsMavenPluginVersion} The version of the Petals Maven plug-in.
${PETALS_SuDependencies} A list of Maven dependencies toward projects (only makes sense for SA projects).
<!-- ${PETALS_TestParent} --> A conditional marker, used to test whether a parent was given or not. Text surrounded with this marker will only appear if a parent was specified in the preferences.


As an example, here is the default template for SU projects.

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
	
	<modelVersion>4.0.0</modelVersion>
	<!-- ${PETALS_TestParent} -->
	<parent>
		<artifactId>${PETALS_ParentArtifactId}</artifactId>
		<groupId>${PETALS_ParentGroupId}</groupId>
		<version>${PETALS_ParentVersion}</version>
	</parent>
	<!-- ${PETALS_TestParent} -->
	
	<name>${PETALS_Name}</name>
	<artifactId>${PETALS_ArtifactId}</artifactId>
	<groupId>${PETALS_GroupId}</groupId>
	<version>${PETALS_Version}</version>
	<packaging>jbi-service-assembly</packaging>
	<description>${PETALS_Description}</description>
	
	<dependencies>
${PETALS_SuDependencies}
	</dependencies>
	
	<build>
		<plugins>
			<plugin>
				<groupId>org.ow2.petals</groupId>
				<artifactId>maven-petals-plugin</artifactId>
				<version>${PETALS_PetalsMavenPluginVersion}</version>
				<extensions>true</extensions>
				<configuration>
					<updateJBIXml>true</updateJBIXml>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

POM Dependencies

This last section only concerns the SA projects.
If the option "Update POM dependencies automatically" is checked, then each time the jbi.xml of a SA project changes (addition, removal, update of a SU project), its POM will be updated automatically. The POM of the referenced SU projects will be read and reported into the POM of the SA project.

Be careful, automatic updates remove all the dependencies before writing the updated ones.
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.