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.
For the moment, the documentation for this Maven plug-in is only available in Petals' forge, but should be soon posted on Petals wiki.

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

Unable to find source-code formatter for language: bash. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
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 fill-in these fields automatically, 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 fill-in these fields automatically, 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, 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.

Maven preferences

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


The following elements can be changed in these preferences.

  • Version of the Petals Maven plug-in: by default, it is the last released version.
  • Default group ID: by default, it is org.ow2.petals.
  • A POM parent: it can be any pom.xml file, whose location is given as an URI. When provided, the parent attributes are written in the generated pom.xml files.

These preferences apply for both SU and SA projects.


Notice that the version 1.0 of the studio does not generate complete pom.xml. There is always something to update by hand.
But the general principal (preferences, Maven structure and POM generation) is the same.
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.