Understanding File Mapping

File mapping is an important part of project generation.  Unlike other generation tools that do not allow customization for how the resulting files are layed out directory wise, Harbormaster gives complete control.


Each technology stack package must contain a single file named mapping.properties. This file can be templatized in the event the outcome of its contents are conditionally based on the domain model content or user input project property.

The following are example syntax on how to declare file routing during project generation. A mapping can optionally contain the following keywords:

  • __classes__ – directs Harbormaster to apply the corresponding file for each entity in the domain model, substituting the entity name.
  • $packageName – will substitute the user declared package name
  • $className – will substitute the name of the current entity in the domain model
  • $appName – will substitute the user declared application name

      Be sure to declare a directory structure using dot notation. For example, /src/main/java/ would be .src.main.java

      entry type description
      #rootLevelMappings() macro A Velocity macro to determine which files below as the root directory. These conditionally include Dockerfile, pom.xml, build.gradle and more.
      #determineCICDPlatformFiles() macro A velocity marco determines which CI/CD platform the user has declared as in use and the appropriate vendor files are processed and output to their apprporiate location
      file mapping Directive for when a file named Application.java is being processed, place the result in directoy src/main/java/<>
          $aib.getEnumClassesToGenerate().size() > 0
      velocity directive with file mapping Velocity directive checking the domain model for at least 1 enumerated type. If there is, the file mapping is declared
      file mapping Directive for when any file is encountered during processing that ends with RestController.java then route it accordingly.
      file mapping Directive for when any file is encountered during processing that begins with CRUD and ends with Test.java then route it accordingly.
      file mapping __classes__ indicates to Harbormaster that for each entity in the model, process this file and substite it with the entity name
      Dockerfile=. file mapping Maps the file to the root (top level) directory of the output
      file exclusions A list of files to exclude from processing
      file mapping maps the corresponding file, or files within the corresponding directory to the subdirectory structure where discovered within the package. For directory declarations be sure to include \\ before and after the name