Skip to main content
ElastiCORE 3.0 is a release candidate: 3.0.261022-rc1 on Maven Central. Projects on the 2.2 line: see the 2.2 documentation.
Version: 3.0

Regenerating safely

In ElastiCORE regenerating is how a change is made, not a risk to your edits: what the model owns and what you own are separate files, and a file you edited is recognised by its content hash.

The loop​

  1. Change the YAML in src/main/resources/blueprint/<domain>/.
  2. ./gradlew compileJava (generation runs first) - or ./gradlew elcore3 to generate only.
  3. Read the whole output: fix every line under [elcore3] DSL validation warnings: in the YAML.
  4. Compile even when generation succeeded - generation succeeds with warnings, and the code may then not compile.
  5. A compile error in a generated file is fixed in the YAML, never in that file.

What each status means​

=== elcore3: 20 written / 0 unchanged / 2 skipped / 0 failed ===
StatusMeaning
WROTE, UNCHANGEDgenerated from the DSL as it is now
REGENERATED(owned, never edited)a file of yours you had not edited yet, brought up to date
SKIP(user-owned)yours; left alone
SKIP(user-modified; -Pforce to overwrite)a generated file edited by hand - it no longer follows the DSL
SKIP(no ElastiCORE header - yours)a file ElastiCORE did not write sits where a generated one would go
SKIP(dontMake)not needed for this model (a member's repository, for example)
REMOVED(the DSL no longer produces it)a generated file nobody edited, deleted because the model no longer has what it was for
ERROR ...generating that file failed

A generated file someone edited​

Move the change into the DSL or a file you own, then restore the file: delete it and generate again. -Pforce overwrites every hand-edited generated file at once - a decision for whoever made those edits, not a routine flag. The agent kit refuses -Pforce unless you allow it.

Code that must live in a generated file​

One preserved block, right before the class's closing brace; the generator puts its code back on every regeneration:

// !-----------------------------------------------------------

@Query("SELECT e FROM Entity e WHERE e.name = :name")
List<Entity> findByName(@Param("name") String name);

// ------------------------------------------------------------!

Removed files​

At the end of a run that generated every domain, files in the generated directories that the run did not write are deleted when their first line is a 3.0 hash line, they are not hand-over files and nobody edited them. An edited one is kept with a warning. A run with -Pdomain=..., a failed artifact or a model check that failed removes nothing.

When a change does not show up​

  • A file you own does not follow the model - it is yours once edited. Delete it (keep what you wrote) and build again to see what is generated now, then move your code over.
  • The TypeScript client is old - elcore3ts is a task of its own; set typescriptClient = true.
  • An old runtime or generator - upgrade both to the same version; with a locally built ElastiCORE, publishToMavenLocal and --refresh-dependencies in the project.
  • A YAML file was left out - look for * LOAD ERROR: in the output. A : in a -- description is the usual cause.

Same DSL, same code​

Generated twice from the same DSL, 0 of 130 files differ (each file's first line - its hash and time - aside); adding a searchable field is one DSL line and 39 changed lines of generated code in 9 files (the change-amplification benchmark in the repository's docs/benchmarks).