Expansion-Resources Stacks
Expansion-resource can include dependencies on other expansion-resources. These dependencies will be fetched if the expansion-resource is not defined in the expansionSettings.xml.
We can use this mechanism to create bundles of expansion-resources.
The nsx-default-stack
is such a bundle. It only defines a set of dependencies on other expansion-resources.
To create a new stack, we must create an expansion-resource that declares the selected expansion-resources as dependencies.
Let's say we want to create my-stack
which contains the nsx-default-stack
and our own my-jpa-expanders
.
First we should create a Maven project file for the expansion-resource:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>net.demo</groupId>
<artifactId>my-stack</artifactId>
<version>1.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>net.democritus.maven.plugins</groupId>
<artifactId>expanders-maven-plugin</artifactId>
<version>2024.6.0</version>
<executions>
<execution>
<goals>
<goal>expansionResource</goal>
</goals>
<configuration>
<rootDirectory>${project.basedir}</rootDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
We define the project basedir as root directory to prevent the plugin.
Then we add the other expansion-resources as dependencies.
<dependencies>
<dependency>
<groupId>net.democritus</groupId>
<artifactId>nsx-default-stack</artifactId>
<version>2024.16.6</version>
</dependency>
<dependency>
<groupId>net.demo</groupId>
<artifactId>my-jpa-expanders</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
Building this project will create a my-stack-1.0.0.jar. You can add it to your local or remote maven repository.
We can now use the expansion-resource by adding it as net.demo:my-stack@1.0.0