Skip to content

ligoj/ligoj-api

Repository files navigation

🔗 Ligoj API plugin Maven Central

API framework for Ligoj plugins

Coverage Quality Gate Codacy Badge CodeFactor Maintainability License

Extension points

Plugin definition extension points

IAM extension points

Maven structure

Minimal Maven structure for a plugin:

  • Version, following the semver convention
  • Plugin artifact id
    • Must start with the parent service plugin artifact id. For sample, plugin plugin-id-ldap is a tool plugin for the service plugin-id.
    • Otherwise, Must start with plugin-, without additional hyphen.
  • Parent service plugin artifact as provided dependency.
<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>
	<parent>
		<groupId>org.ligoj.api</groupId>
		<artifactId>plugin-parent</artifactId>
        <version>4.1.8</version> <!-- Version of plugin API -->
		<relativePath />
	</parent>

	<groupId>org.ligoj.plugin</groupId>
	<artifactId>plugin-id-ldap</artifactId> <!-- Tool plugin artifact-id, must start with "plugin-" -->
	<version>1.1.3-SNAPSHOT</version>       <!-- Tool plugin version -->
	<packaging>jar</packaging>

    <!-- Feature dependency -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.ligoj.plugin</groupId>
                <artifactId>plugin-id</artifactId>        <!-- Service plugin artifact-id -->
                <version>[2.2.0-SNAPSHOT,2.3.0)</version> <!-- Service plugin version range -->
                <scope>provided</scope>                   <!-- Always provided -->
            </dependency>
        </dependencies>
    </dependencyManagement>
</project>

Build a plugin

Produced artifacts for a plugin named plugin-id-ldap are:

  • Main jar file: plugin-id-ldap-1.0.0.jar
  • Javadoc jar file: plugin-id-ldap-1.0.0-javadoc.jar. Optional, but when deployed, contributes to generated OpenAPI JSON file.
  • Sources jar file: plugin-id-ldap-1.0.0-sources.jar. Optional.
  • Test sources jar file: plugin-id-ldap-1.0.0-test-sources.jar. Optional.
  • Jacoco coverage result

The following command generate all artifacts and run UTs and Its

mvn package -Pjavadoc,jacoco,sources

Install a plugin

From the UI

The common steps:

  • Login to application
  • Go to the Administration page
  • Choose the Plugin section

Install a local plugin

The specific steps:

  • Click on Install > Install from file
  • In the modal, fill the inputs accordingly to your plugin
  • Upload it
  • Restart the application

Install a deployed Maven plugin

The specific steps:

  • Click on Install > Install from repository
  • In the modal, type the artifact name
  • Choose one or many plugins
  • Confirm
  • Restart the application

From the Ligoj CLI

The Ligoj CLI is an administration tool for all Ligoj API operations.

See all command options with ligoj plugin

Install a local plugin

The command is:

ligoj plugin upload --id "plugin-id-ldap" --version "1.1.4" --from "/path/to/plugin-id-ldap-1.1.4.jar"

Install a deployed Maven plugin

The command is:

ligoj plugin install --id "plugin-id-ldap" --version "1.1.4"  --repository "central" --javadoc