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-codegen
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
.
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
, and npl-multigen
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
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
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
generateOpenApi
Generates OpenApi generation
Optionality
optional, disabled by default
Goals used by
npl-codegen
Accepted Values
[simple, full]
- simple: Generates all the protocols' create and action specifications against the Engine API using ApiValues.
- full: Generates all the protocols' complete type specifications for creation and action execution; ApiValues are omitted. The client is responsible for mapping to/from ApiValues and manual dispatching to Engine.
openApiOutputDirectory
The output directory for OpenApi generation
Optionality
optional
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
tag
The tag for the generated sources
Optionality
optional
Goals used by
npl-codegen
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.
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>2023.3.0</version>
<executions>
<execution>
<goals>
<goal>npl-codegen</goal>
<goal>npl-puml</goal>
<goal>npl-compile</goal>
<goal>npl-test-compile</goal>
<goal>npl-test</goal>
</goals>
</execution>
</executions>
<configuration>
<enableCompilerOptimisations>true</enableCompilerOptimisations>
</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
).