To set up Maven, you can follow instructions in:
Apache's Maven in 5 minutes for quick start.
The Apache Maven definitive guide by Sonatype for a complete reference.
Setting Maven to use eXo Repository
Since eXo Platform 4, no specific Maven settings are required to build eXo projects.
If you want to use eXo APIs in your own projects, you can add the eXo Platform Maven repository to your
pom.xml
or settings.xml
.
The settings.xml
file's path is $M2_HOME/conf/settings.xml
or ${user.home}/.m2/settings.xml
, depending on your Maven installation.
Refer to Maven settings guideline for more details.
Add a repository as stated in Maven's Guide to using Multiple Repositories.
The URL to be used in your settings: http://repository.exoplatform.org/public.
An example of settings.xml
:
<settings>
...
<profiles>
...
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>eXo-pub-repo</id>
<name>eXoPlatform public repo</name>
<url>http://repository.exoplatform.org/public</url>
</repository>
</repositories>
</profile>
...
</profiles>
<activeProfiles>
<activeProfile>myprofile</activeProfile>
</activeProfiles>
...
</settings>
Importing eXo Dependencies to your project
Follow the guideline about Maven dependencies in An Introduction to the Dependency Mechanism.
You can, of course, add any eXo artifact as a dependency of your project.
To avoid losing time looking for the good version of the artifacts you want to add as dependencies,
eXo Platform provides an import dependency which defines all of the versions for you.
You just need to give the version of eXo Platform you are using (4.1.0 in the following example of pom.xml
),
without concerning about proper versions of all artifacts:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>my-project</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>My project</name>
<properties>
<exoplatform.version>4.1.0</exoplatform.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Import versions from platform project -->
<dependency>
<groupId>org.exoplatform.platform</groupId>
<artifactId>platform</artifactId>
<version>${exoplatform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Check the versions (exoplatform.version
)
here.