Model Resources
Expansion resourcesExpansion Resource (ExpansionResource). A reusable resource bundle containing expanders and features that provide specific application capabilities, defined in the expansion settings and added to the classpath during expansion. can also include components which can be added to your applicationApplicationThe overarching model container grouping all components, domain logic, and configurations for an enterprise solution. if the expansion resourceExpansion Resource (ExpansionResource). A reusable resource bundle containing expanders and features that provide specific application capabilities, defined in the expansion settings and added to the classpath during expansion. is present. This is a useful way to make reusable components which can be shared and versioned.
To add a component directory to your expansion resourceExpansion Resource (ExpansionResource). A reusable resource bundle containing expanders and features that provide specific application capabilities, defined in the expansion settings and added to the classpath during expansion., add a models.xml file to your resources:
<modelResource>
<path>components</path>
</modelResource>
Path should define the location of the component directories within the jar.
The above xml would correspond to a project with a structure:
src/
main/
resources/
components/
models.xml
customers/
model/
harvest/
ext/
orders/
model/
harvest/
ext/
pom.xml
When expanding with this ModelResource, the component directory will be extracted in the local target directory and will be handled in the same way as components in the source directory.
When developing ModelResources, it is convenient to test with a SNAPSHOT version that you install in your local Maven
cache though the mvn clean install command.
If you want to use this SNAPSHOT version in a project, make sure you run the maven command to expand with the clean
lifecycle as mvn clean expanders:expand.
Since, the expansion process unpacks the components from an expansion resourceExpansion Resource (ExpansionResource). A reusable resource bundle containing expanders and features that provide specific application capabilities, defined in the expansion settings and added to the classpath during expansion. to the target folder, it needs to be removed if we want to update the files. This folder is managed by maven and will not be updated with a new copy of the SNAPSHOT you install unless the clean stage is used to remove the target folder.
This article describes the packaging of components. But the same thing can be done with other Modules.