Updating Libraries in expansion
It is possible to change the versions of libraries in the expanded projects by redefining Library instances in a DataResource file.
pom.xml
To achieve this, we need to create a new expansion-resource.
In the pom.xml, we need to attach the expansionResource goal of the expandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact.-maven-plugin to the build.
In addition, we can define dependencies for the libraries we want to update.
In this example we also define dependencies on prime-core and ExpandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact.. To avoid introducing unexpected versions in your expansion, it is best to keep these versions in sync with the prime-core and expandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact. version used in your project.
<?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>org.normalizedsystems.example</groupId>
<artifactId>library-updates</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<expanders-maven-plugin.version>2026.2.1</expanders-maven-plugin.version>
<struts2.version>6.3.0.1</struts2.version>
</properties>
<dependencies>
<!-- prime-core and Expanders versions are best aligned with expansion-resource stack -->
<dependency>
<groupId>net.democritus.metamodel</groupId>
<artifactId>prime-core</artifactId>
<version>2026.4.3</version>
</dependency>
<!-- Dependency on Expanders makes sure this expansion-resource in loaded after Expanders -->
<dependency>
<groupId>net.democritus</groupId>
<artifactId>Expanders</artifactId>
<version>9.5.0</version>
</dependency>
<!-- By adding the dependency to the pom.xml file, the versions can be managed with maven. -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<!-- Filter xml files to insert versions from the properties in the pom.xml file. -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>net.democritus.maven.plugins</groupId>
<artifactId>expanders-maven-plugin</artifactId>
<version>${expanders-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>expansionResource</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
libraries.xml
Next, we define a libraries.xml data-resource. In this file, the name of the library matches Library instances
already defined by ExpandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact..
The modelLoader will merge the data by applying the new versions of the Library instances.
<dataResource type="elements::Library">
<library name="struts2-core">
<version>${struts2.version}</version>
</library>
<library name="struts2-json-plugin">
<version>${struts2.version}</version>
</library>
</dataResource>
Note that it is possible to use this mechanism to downgrade the versions of libraries. There is no systemSystemA set of interconnected components that work together to achieve a specific purpose or function. in place to keep this from happening. It is the responsibility of the developer creating this expansion-resource to keep the version up-to-date. This way, you keep up-to-date with the latest security patches and avoid api conflicts with the expanded code.