Dec 13, 2019 11:23:39 PM Thomas Dumont avatar   2643

Create a Lutèce site POM.xml


POM Composition

The POM file for a Lutece site contains at least the following information :

  • The declaration of the parent POM lutece-site-pom in its latest version
  • The site metadatas (version, name, groupId, artifactId...)
  • Maven repository statements for Lutece project :
    • luteceRepository repository : contains stable versions of Lutece components
    • luteceSnapshot repository : contains snapshot versions (optional)
  • The declaration as dependencies of the plugins that make up the site

Recommendations

For the creation of a stable version of a site, it will be necessary to ensure that all the dependencies including the transitive dependencies are also fixed to a stable version in order to guarantee that the site brings back the same versions of components at each redeployment. For this, the explicit versions must be used in square brackets in the dependencies. It may also be useful to remove the declaration from the "Snapshot" repository to ensure that all versions of the components are stable.

The parent lutece-site-pom POM defines a certain number of default maven profiles (see Site specific configuration). Unless there is a specific situation, it is often not necessary to define new profiles in the site POM.

Dependency Management

Several tools are available for the development of POM sites:

  • AppStore : Provides POMs of standard sites incorporating the latest versions of each of the plugins.
  • List of Components : Provides a list of all components (plugins, modules, libraries) with the latest Release and Snapshot versions as well as quick access to current changes and anomalies.
  • Upgrade Dependencies : Provides the list of dependencies in their latest version in XML format of the POM for a given list of plugins.
  • Creating a Site POM : Generates a site POM from a list of plugins

Example of POM

Here is an example of a POM :

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

    <parent>
        <artifactId>lutece-site-pom</artifactId>
        <groupId>fr.paris.lutece.tools</groupId>
        <version>2.0.4</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>fr.paris.lutece</groupId>
    <artifactId>site-mysite</artifactId>
    <packaging>lutece-site</packaging>
    <name>Site My Site</name>
    <version>1.0.0-SNAPSHOT</version>

    <repositories>
        <repository>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <id>luteceSnapshot</id>
            <name>luteceSnapshot</name>
            <url>http://dev.lutece.paris.fr/snapshot_repository</url>
        </repository>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>lutece</id>
            <name>luteceRepository</name>
            <url>http://dev.lutece.paris.fr/maven_repository</url>
        </repository>
    </repositories>

    <dependencies>

        <!-- Lutece Core -->
        <dependency>
            <groupId>fr.paris.lutece</groupId>
            <artifactId>lutece-core</artifactId>
            <version>5.0.1</version>
            <type>lutece-core</type>
        </dependency>

        <!-- Specific plugins -->
        <dependency>
            <groupId>fr.paris.lutece.plugins</groupId>
            <artifactId>plugin-myplugin</artifactId>
            <version>1.2.1</version>
            <type>lutece-plugin</type>
        </dependency>
        ...

        <!-- Generic plugins -->
        <dependency>
            <groupId>fr.paris.lutece.plugins</groupId>
            <artifactId>plugin-contact</artifactId>
            <version>4.0.0</version>
            <type>lutece-plugin</type>
        </dependency>
        ...
        <dependency>
            <groupId>fr.paris.lutece.plugins</groupId>
            <artifactId>plugin-systeminfo</artifactId>
            <version>3.1.0</version>
            <type>lutece-plugin</type>
        </dependency>

    </dependencies>
</project>