Skip to content

NPL Maven plugin

Introduction

The NPL Maven Plugin supports various NPL-related operations to be executed as part of a build. It serves as the main entry point for all build tools.

To install and configure Maven itself (as well as repository access), please follow the instructions provided here.

Goals

This section describes the supported operations.

npl-compile

Compilation invokes the NPL compiler on the sources. It serves as a means to verify that the code indeed compiles without actually running it.

npl-test-compile

Compilation invokes the NPL compiler on the test sources. It verifies that the test code compiles without actually running it.

Setting maven.test.skip (or mavenTestSkip) behaves similarly to the Maven Surefire plugin maven.test.skip property, tests are neither compiled nor executed.

npl-test

NPL tests may be run as part of the Maven test phase. The plugin will scan all files in the test directory for the presence of tests, and run them.

A summary of test results is printed for every run. Files that do not contain any tests will not show up in the summary output. Individual tests are not visible in the test result summary unless they fail. A failing test will cause the entire build to fail.

Setting skipTests behaves similarly to the Maven Surefire plugin skipTests property, tests are compiled, but not executed.

Similarly, setting skipNPLTests allows one to skip execution of NPL tests. This property can be useful if you want to disable execution of NPL tests only, while still executing other tests, e.g. integration tests.

npl-puml

Generates UML files from your NPL sources in the form of PlantUML files. Based on the sources property below.

See the UML Generator for more details.

This goal can be skipped using skipPumlGeneration.

npl-contrib

Unpacks all available NPL contributor libraries into a target build folder. Use mvn generate-sources or mvn compile to unpack. This step is necessary prior to development in IntelliJ.

This goal can be skipped using skipNPLContribUnpack.

npl-codegen

Deprecated goal (since 2024.2.0, to be removed in 2026.1.0)

Use the npl-api goal to generate OpenAPI specifications instead, and then use the OpenAPI Generator Maven plugin or similar to generate client code in your desired language.

See the Kotlin code generator for more details.

This goal can be skipped using skipNPLGeneration.

npl-multigen

Generates multi-node notifications. It is based on sources property below.

This goal can be skipped using skipMultiGeneration.

npl-api

Generates the OpenAPI specifications. See the OpenAPI generator for more details.

This goal can be skipped using skipOpenAPIGeneration.

Configuration

Properties

The following configuration properties are available:

sources

The main sources directory

Optionality

required

Goals used by

npl-compile, npl-test-compile, npl-test, npl-puml, npl-multigen, and npl-api

testSources

The test sources directory

Optionality

required

Goals used by

npl-test-compile, and npl-test

mavenTestSkip

Do not compile or execute tests

Optionality

optional

Goals used by

npl-test-compile, and npl-test

Default Value

false

skipTests

Compile, but do not execute tests

Optionality

optional

Goals used by

npl-test

Default Value

false

skipNPLTests

Compile, but do not execute tests

Optionality

optional

Goals used by

npl-test

Default Value

false

tag

The tag for the NPL and generated sources

Optionality

optional

Goals used by

npl-compile, npl-test-compile, npl-test, npl-puml, npl-multigen, npl-codegen, and npl-api

extension

The extension of NPL sources

Optionality

required

Goals used by

npl-compile,npl-test-compile, and npl-test

Default Value

npl

enableCompilerOptimisations

Enables compiler optimisations, such as automatic code removal of statements without side effects, and statements which don't have an impact on the execution of the code

Optionality

optional

Goals used by

npl-compile and npl-test-compile

Default Value

false

skipNPLContribUnpack

Skips NPL contrib unpacking

Optionality

optional

Goals used by

npl-contrib

Default Value

false

nplContribUnpackDirectory

The output directory for the NPL contrib unpacking

Optionality

required

Goals used by

npl-contrib

nplContribPath

Location of NPL contributor libraries

Optionality

optional

Goals used by

npl-contrib, npl-compile, npl-test-compile, npl-test, npl-puml, npl-multigen, npl-codegen, and npl-api

Default Value

${project.basedir}/npl-contrib

skipPumlGeneration

Skips PlantUML files generation

Optionality

optional

Goals used by

npl-puml

Default Value

false

pumlOutputDirectory

The output directory for PlantUML files generation

Optionality

required

Goals used by

npl-puml

codegenInputDirectory

The sources directory for the code generator

Optionality

required

Goals used by

npl-codegen

codegenOutputDirectory

The output directory for the code generator

Optionality

required

Goals used by

npl-codegen

generateFacadeFactory

Generates the facade factory method

Optionality

optional

Goals used by

npl-codegen

Default Value

true

skipNPLGeneration

Skips code generation

Optionality

optional

Goals used by

npl-codegen

Default Value

false

includeTagInPackage

Includes tag for the generated code

Optionality

optional

Goals used by

npl-codegen

Default Value

false

skipMultiGeneration

Skips multi-node code generation

Optionality

optional

Goals used by

npl-multigen

Default Value

false

multinodeDefinitionOutputDirectory

The output directory for multi-node code generation

Optionality

required

Goals used by

npl-multigen

The goals correspond to the sections described in goals.

openAPIOutputDirectory

The output directory for OpenAPI generation

Optionality

required

Goals used by

npl-api

serverURI

Server URI for the OpenAPI spec

Optionality

optional

Goals used by

npl-api

Default Value

https://engine.example.com/

skipOpenAPIGeneration

Skips OpenAPI generation

Optionality

optional

Goals used by

npl-api

Default Value

false

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>npl-maven-plugin</artifactId>
            <!-- Make sure this version matches your platform version! -->
            <version>2024.2.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>npl-contrib</goal>
                        <goal>npl-api</goal>
                        <goal>npl-puml</goal>
                        <goal>npl-compile</goal>
                        <goal>npl-test-compile</goal>
                        <goal>npl-test</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <tag>app-1.0.0</tag>
                <enableCompilerOptimisations>true</enableCompilerOptimisations>
                <nplContribPath>${project.basedir}/npl-contrib</nplContribPath>
            </configuration>
        </plugin>
    </plugins>
</build>

Please note that in certain cases, the IntelliJ project settings need to be adjusted such that generated sources are not excluded (File -> Project structure, look for Modules under Project Settings).