Create a new Expansion Resource Project
What is an Expansion Resource?
An expansion-resource or expansion-resource bundle is a jar which can contain:
- Expanders, which will generate new artifacts
- Features, which can insert content into artifacts from expanders of this expansion resource or expansion resources the project depends on
- Additional expansion steps, which can perform tasks before, during or after expansion
And if you really feel fancy, you can add the following:
- Data resources, which contain metadata like technologies, layerImplementations etc.
- Model resources, which provide components for expansion
This section will use maven to build the expansion-resource with the help of the expanders-maven-plugin.
The expanders-maven-plugin has an
expansionResource goal that will generate an
This file is a manifest which describes all resources included in the expansion-resource jar.
Create a new project with maven and add the
expanders-maven-plugin to the build:
<?xml version="1.0" encoding="UTF-8"?>
You can find the latest version of the plugin on expanders-maven-plugin.
This will generate a manifest:
The manifest defines the name and version of the expansion-resource. Because the project does not contain any resources yet, none are defined in the manifest.
If at any point your expanders or other resources are not included in the expansion, the manifest is the first place to check, since resources not included in the manifest will not be used during expansion!
Providing Expanders, Features and Additional Expansion Steps
When building, the plugin will search for expanders, features and additional expansion steps in a specific source directory.
By default, this directory is
src/main. It is possible to override this by configuring the
rootDirectory in the plugin.
The plugin recognizes the resources based on some characteristics:
- Expanders: ends with
Expander.xml, contains a root tag
- Features: ends with
.xmland contains a root tag
- Additional Expansion Steps: ends with
Step.xmland contains root tag
The plugin will also look for any dependencies of the project that are expansion-resources. These dependencies will be added to the expansion-resource manifest:
E.g. adding the following dependency to your pom.xml:
will result in the dependency being added to your manifest:
<dependsOn name="net.democritus:Expanders" version="5.24.1"/>
If this information is defined, nsx-prime will do the following when running an expansion with this resource:
- If the current expander version is older than the version in the dependency, nsx-prime will complain about a version mismatch
- If the dependency references another expansion-resource that is not present, it will be fetched and added to the expansion
If you require non-expansion-resource libraries, you can enable ClassPathDependencies.