Skip to main content

Harvesting ext code

Ext code in JEE Application Projects

In JEE ApplicationApplicationThe overarching model container grouping all components, domain logic, and configurations for an enterprise solution. projects, the base expandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact. generate /ext directories that are harvested. 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. that expand into these projects do not need to implement ext harvestingHarvestingThe process of extracting and persisting custom code from anchors and ext directories back into source directories..

HarvestingHarvestingThe process of extracting and persisting custom code from anchors and ext directories back into source directories. ext code is implemented by expansion steps, which copy the code from and to the harvest directories in the source repository.

The harvest-expanders provide a reusable way to harvest ext code. It has a builtin mechanism that remembers which files are generated by expandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact.. This allows it to harvest only files that were added by the developer, so that the custom files no longer need to be placed in a separate ext directory.

To use them:

  1. Add the harvest expandersExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact. as a dependency 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..
pom.xml
<!-- pom.xml -->
<dependencies>
<dependency>
<groupId>net.democritus.expander</groupId>
<artifactId>harvest-expanders</artifactId>
<version>${harvest-expanders.version}</version>
</dependency>
</dependencies>

Add a rule that adds the #harvest.mixedSourceFiles tag to the program and module elements of your model.

data/elementTagRules.xml
<dataResource type="expansionControl::ElementTagRule">
<tag name="Enable mixed source harvest on Application">
#harvest.mixedSourceFiles :- instanceOf(elements::Application)
</tag>
<tag name="Enable mixed source harvest on Component">
#harvest.mixedSourceFiles :- instanceOf(elements::Component)
</tag>
</dataResource>

Finally, create an ExpanderExpanderA unit of generation that combines a data tree instance (functional M1 model) with a template to generate an artifact. to generate a .harvestInclude file. This file specifies which directories are eligible to harvest. Each line contains a glob of a relative path to include, lines starting with # are ignored. For example:

expansions/myapp/.harvestInclude
# include java sources
src/main/java/**

# include docs
docs/*