Skip to content

Engine Maven plugin

New feature (added in 2022.1.45)

Introduction

The Engine Maven Plugin allows the Engine Management Api to be invoked as a Maven goal.

This plugin should be invoked during CI/CD or manually from the terminal/CLI during development. It sends HTTP requests to the specified engine (which must already be up and available) URL.

You will need to have set up your Development Environment.

Goals

This section describes the supported operations.

clean-engine

Cleaning invokes the clear endpoint on the engine, which clears the application contents. It provides a clean slate by removing any existing prototypes, protocols, and related data from the database.

deploy-source

Deploying invokes the deploy endpoint on the engine, which deploys NPL sources and migrations. Specify a directory from which to deploy, that contains the correct folders and files. There is no need to zip the directory, the goal will handle that.

Configuration

Properties

The following configuration properties are available:

engineManagementUrl

The base URL of the Engine Management API

Optionality

required

Goals used by

clean-engine and deploy-source

Default Value

http://localhost:12400

authUrl

The base URL of the authentication endpoint

Optionality

required

Goals used by

clean-engine and deploy-source

Default Value

http://localhost:11000

username

The username for the user to be used for authentication

Optionality

required

Goals used by

clean-engine and deploy-source

password

The password for the user to be used for authentication

Optionality

required

Goals used by

clean-engine and deploy-source

clientId

The client Id for the client to request an authentication token

Optionality

required

Goals used by

clean-engine and deploy-source

clientSecret

The client secret for the client to request an authentication token

Optionality

optional

Goals used by

clean-engine and deploy-source

deploymentDirectory

The directory containing NPL sources and migrations

Optionality

required

Goals used by

deploy-source

The goals correspond to the sections described in goals.

Example setup

A complete sample configuration looks as follows:

<build>
    <plugins>
        <plugin>
            <groupId>com.noumenadigital.platform</groupId>
            <artifactId>engine-maven-plugin</artifactId>
            <!-- Make sure this version matches your platform version! -->
            <version>2023.3.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>clean-engine</goal>
                        <goal>deploy-source</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <engineManagementUrl>http://localhost:12400</engineManagementUrl>
                <authUrl>http://localhost:11000</authUrl>
                <username>joe</username>
                <password>secure123</password>
                <clientId>an-id</clientId>
                <clientSecret>secure-secret-123</clientSecret>
                <deploymentDirectory>src/deploymentdir</deploymentDirectory>
            </configuration>
        </plugin>
    </plugins>
</build>

Example directory

deploymentdir
├── kotlin-script
│   ├── migration.kts
├── npl-1.0.0
│   ├── stub.npl
└── migration.yml

Usage from terminal

You can invoke these Maven goals locally from the terminal against a local engine with the following commands

mvn clean engine:clean-engine -D<param>=<paramValue>
mvn clean engine:deploy-source -D<param>=<paramValue>

Goal prefix

In order to execute the goal with the prefix, (i.e. engine:clean-engine) you need the following in ~/.m2/settings.xml

<pluginGroups>
    <pluginGroup>com.noumenadigital.platform</pluginGroup>
</pluginGroups>

Without the prefix, you can run the goals with the fully qualified name:

mvn com.noumenadigital.platform:engine-maven-plugin:0.0.1-SNAPSHOT:clean-engine -D<param>=<paramValue>