Working with Lutece plugins

Project layout

As with the core, Lutece plugins declare a specific packaging in the POM:

<project>
        ...
        <groupId>fr.paris.lutece</groupId>
        <artifactId>lutece-foobar-plugin</artifactId>
        <packaging>lutece-plugin</packaging>
        <version>1.0</version>

A Lutece plugin also has a dependency on a lutece-core artifact:

<project>
        ...
        <dependencies>
                ...
                <dependency>
                        <groupId>fr.paris.lutece</groupId>
                        <artifactId>lutece-core</artifactId>
                        <version>2.0.0</version>
                        <type>lutece-core</type>
                </dependency>

The directory structure is similar to that of the core, but contains only plugin-specific elements:

  • src/java : the plugin-specific Java classes;

  • src/conf/default : the plugin-specific configuration files (default version);

  • webapp : the plugin-specific webapp components.

Development and testing

To try your plugin, call the lutece:exploded goal :

mvn lutece:exploded

This will:

  • retrieve the lutece-core artifact from the Maven repository;

  • install an exploded version of the core in target/lutece ;

  • copy the plugin-specific components to this exploded directory;

  • copy any specified configuration files (see this page ).

In the end, target/lutece contains a Lutece instance with your plugin installed. You can configure a Tomcat context on this directory to begin testing.

Packaging

The packaging is the same as the core's. mvn package will generate:

  • a JAR containing the plugin-specific classes ;

  • a ZIP containing the plugin-specific webapp components.

Generate Lutece plugin distribution

mvn lutece:assembly

This command will generate two artifacts :

  • a ZIP containing plugin's sources

  • a ZIP containing plugin's binary version, which could be paste over existing Lutece core webapp. (plugin should be activate in the Administration control panel)