nsx-default-stack Expansion Resource

Since expanders version 4.4.0, all resources used for expansion need to be explicitly defined. This means that resources like the base-components and web-styles are no longer provided by default.

In their place, a nsx-default-stack expansion-resource has been defined to include all resources needed to expand a regular application. The default stack will automatically add the following resources:

  • prime-data: includes standard data such as layers, technologies and libraries
  • Expanders: the default expanders control structure and all basic expanders
  • web-styles: resource files used by the frontend
  • base-components: provides models for the base-components and other related functionality

By explicitly defining the version of the nsx-default-stack in the expansionSettings, expanding an application will be better reproducible than in the previous setup where it was common for developers to have different installations.

How to use the default stack

To use this setup, you must:

  1. Set the expandersVersion in the applicationInstance to PROVIDED. In your expansionSettings.xml files, remove the <expandersVersion> if it was defined, or set it to PROVIDED as well.
  2. Add net.democritus:nsx-default-stack@<version> (with version replaced with the latest version) as an expansion-resource on the expansion-resources tab of the expand page or directy to the expansionSettings.xml.

Your expansion should now run the same as before.

How to define specific versions of the Expanders or other resources

Let’s say we want to use the 2020.7.0 default stack, but use a newer expanders version.
In that case, we can add the resource explicitly:

By defining the version explicitly, nsx-prime will prefer the defined version. Note that you can only force newer versions. Using an older version will result in a conflict with the nsx-default-stack dependency!

How to define a custom stack

It is also possible to create a custom stack that groups a selection expansion-resources that is more relevant to your applications. To do this, 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 create a pom.xml file for an 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</groupId>
        <artifactId>expanders-maven-plugin</artifactId>
        <version>2020.9.0</version>
        <executions>
          <execution>
            <goals>
              <goal>expansionResource</goal>
            </goals>
            <configuration>
              <rootDirectory>${project.basedir}</rootDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

Then we add the other expansion-resources as dependencies.

<dependencies>
  <dependency>
    <groupId>net.democritus</groupId>
    <artifactId>nsx-default-stack</artifactId>
    <version>2020.9.0</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