This page describes how to create a server project and add it to the Mobicents platform Maven project. If you are new to Maven please read it's 30 minute start guide.
Introduction to the Mobicents root POM
The Mobicents project's root POM is a library for the whole platform, and should be inherited by all POMs, explicitly or implicitly. It provides the following features:
- All (normal and plugins) Maven repositories configuration
- Default build configuration, such as DEBUG info and 1.5 Java Sources
- Distribution management, support for releases and snapshots in JBoss maven repositories
- Global platform properties such as external dependency versions
- Central dependency management, the POM declares all external dependencies default versions, thus a user only has to import the root POM and use dependencies without caring what is their particular version
Where to start for your server
All servers go into /servers folder of the Mobicents SVN project. Start by creating the folder for your server (let's say its name is serverName) and create there its root POM like this one:
<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>
<packaging>pom</packaging>
<parent>
<artifactId>mobicents</artifactId>
<groupId>org.mobicents</groupId>
<version>CURRENT_MOBICENTS_SNAPSHOT_VERSION</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>mobicents-server-serverName</artifactId>
<groupId>org.mobicents.servers.serverName</groupId>
<version>1.0.0.BETA1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<groupId>org.mobicents.tools</groupId>
<version>${mobicents.tools.mavenplugin.eclipse.version}</version>
<inherited>false</inherited>
<executions />
<configuration>
<eclipseProjectName>${pom.artifactId}</eclipseProjectName>
</configuration>
</plugin>
</plugins>
</build>
<scm>
<connection>scm:svn:https://mobicents.googlecode.com/svn/trunk/servers/serverName</connection>
<developerConnection>scm:svn:https://mobicents.googlecode.com/svn/trunk/servers/serverName</developerConnection>
<url>http://mobicents.googlecode.com/svn/trunk/servers/serverName</url>
</scm>
</project>
The <build/> element allows Mobicents Maven Eclipse plugin to take care of managing your eclipse project files, it's not mandatory but it's recommended. The <scm/> element configures the svn properties for releasing your server, don't change it.
Of course it's not mandatory to use the values shown for artifactId, groupId, etc. but this will keep coherence with other servers.
Next is to add other Mobicents servers or tools that your server depends:
- add a property with each server (that yours depend) version
<properties>
<!-- module versions -->
<mobicents.servers.media.version>...</mobicents.servers.media.version>
<mobicents.servers.jainslee.version>...</mobicents.servers.jainslee.version>
<mobicents.servers.sipservlets.version>...</mobicents.servers.sipservlets.version>
- add a dependency in dependencyManagement
<dependencyManagement>
<dependencies>
<!-- module versions -->
<dependency>
<groupId>org.mobicents.servers.media</groupId>
<artifactId>mobicents-server-media-parent</artifactId>
<version>${mobicents.servers.media.version}</version>
</dependency>
<dependency>
<groupId>org.mobicents</groupId>
<artifactId>mobicents-jainslee-server</artifactId>
<version>${mobicents.server.jainslee.version}</version>
</dependency>
<dependency>
<groupId>org.mobicents.servlet.sip</groupId>
<artifactId>sip-servlets-bootstrap</artifactId>
<version>${mobicents.servers.sipservlets.version}</version>
</dependency>
<dependency>
<artifactId>sip-presence-parent</artifactId>
<groupId>org.mobicents.servers.sippresence</groupId>
<version>${mobicents.servers.sippresence.version}</version>
</dependency>
This will make it possible to not refer the version in child POMs, and will also allow users to import this POM, which means those POMs (and their children) will not need to define versions too.
Guidelines for other POMs in your server
- only the root POM has a version and groupId, child POMs inherit those values, this is essential for the release process
- if your server shares runtime resources (such as JBoss AS) with other servers then your servers POMs MUST NOT have a EXTERNAL dependency (other elements of the Mobicents platform included) with VERSION. Shared external dependencies versions are declared in the Mobicents platform root POM
Adding a external dependency to a POM in your server
Before using this to add a <dependency/> in a POM of your server, please note that If the POM is for a tool or component that uses a specific JVM instance to run, then this guideline does not apply.
It's desirable that all servers that share runtime resources use the same versions of dependencies, avoiding runtime issues.
To introduce a external dependency, first step is to verify if that dependency is already declared in Mobicents root POM <dependencyManagement/> element, if not then:
- add a property (please keep alphabetic order), lets say dependency name is dependencyName and dependency version is dependencyVersion:
<properties>
<!-- ... -->
<dependencyName.version>dependencyVersion</dependencyName.version>
- add the dependency (please keep alphabetic order) with artifactId dependencyArtifactId and groupId dependencyGroupId to dependencyManagement
<dependencyManagement>
<dependencies>
<!-- ... -->
<dependency>
<groupId>dependencyGroupId</groupId>
<artifactId>dependencyArtifactId</artifactId>
<version>${dependencyName.version}</version>
</dependency>
Once the dependency is in Mobicents root POM all you need in your POM is to declare the dependency as:
<dependencies>
<dependencies>
<!-- ... -->
<dependency>
<groupId>dependencyGroupId</groupId>
<artifactId>dependencyArtifactId</artifactId>
</dependency>
Resources
-
Mobicents SVN Repository guide
-
-
How to release the whole Mobicents platform
TODO
- add info on how to add the server to mobicents-all
Author: Eduardo Martins