Other forms of Dependencies
Expansion-resource dependencies have the following behaviour:
- If an expansion-resource has a dependency on another resource, that resource is included in the expansion.
- If a dependency clashes with an expansion-resource defined at root level, the expansion will fail to prevent the expanders from running with an incompatible version of the dependency.
In some cases, however, we might require some different behaviour:
- A Symbiotic dependency is not automatically resolved. Instead, it only resolves when a combination of other expansion-resources is used.
- Expansion-resources can replace other expansion-resources.
Symbiotic dependencies
Symbiotic dependencies are not included automatically, but only in case a number of other expansion-resources are present. This allows expander developers to create resources that provide integration with other expander beams.
How it works
Several expander projects have 1 goal, but multiple expansion-resources. This setup exists to support integration with specific use-cases without introducing hard dependencies.
E.g. enum-type-expanders has separate resources for integration with angular and rest.
net.democritus.experimental.enumtypes:enum-type-expanders
net.democritus.experimental.enumtypes:enum-type-rest-expanders
net.democritus.experimental.enumtypes:enum-type-angular-expanders
However, this means that the expansionSettings become more complex:
<expansionSettings>
<expansionResources>
<expansionResource name="net.democritus:angular-svcapi-stack" version="1.4.0"/>
<expansionResource name="net.democritus.experimental.enumtypes:enum-type-expanders" version="0.4.2"/>
<expansionResource name="net.democritus.experimental.enumtypes:enum-type-rest-expanders" version="0.4.2"/>
<expansionResource name="net.democritus.experimental.enumtypes:enum-type-angular-expanders" version="0.4.2"/>
</expansionResources>
</expansionSettings>
Symbiotic dependencies are only included if all of their dependencies are included by other expansion-resources.
In this case, an enum-type-beam
expansion-resource can add enum-type-rest-expanders
and enum-type-angular-expanders
as symbiotic dependencies.
When used with rest-expanders, enum-type-rest-expanders
will be included.
When used with angular-expanders, enum-type-angular-expanders
will be included.
Usage
To create a symbiotic dependency, add the dependency to your maven pom.xml
.
Then, configure the dependency in the expanders-maven-plugin
configuration.
<plugin>
<groupId>net.democritus.maven.plugins</groupId>
<artifactId>expanders-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>expansionResource</goal>
</goals>
<configuration>
<symbioticDependencies>
<dependency>
<groupId>net.democritus.experimental.enumtypes</groupId>
<artifactId>enum-type-angular-expanders</artifactId>
</dependency>
<dependency>
<groupId>net.democritus.experimental.enumtypes</groupId>
<artifactId>enum-type-rest-expanders</artifactId>
</dependency>
</symbioticDependencies>
</configuration>
</execution>
</executions>
</plugin>
Replacing Expansion-Resources
In some cases, you might need to replace an expansion-resources with another implementation that does not have the
same groupId
or artifactId
.
How it works
When an expansion-resources replaces another, the replaced expansion-resource is removed from the set. All other resources depending on the replaced one will instead use the new resource.
Usage
To define a replacement, configure the replace
property in your maven pom.xml
.
<plugin>
<groupId>net.democritus.maven.plugins</groupId>
<artifactId>expanders-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>expansionResource</goal>
</goals>
</execution>
<configuration>
<details>
<replaces>org.normalizedsystems:my-other-expanders</replaces>
</details>
</configuration>
</executions>
</plugin>