Modifying Generated Code
Overview
ElastiCORE automatically generates code based on DSL (model/*.yml) definitions. When modifying generated code, you need to understand ElastiCORE's regeneration mechanism and make changes correctly.
Generated Code Marker
Generated source files contain the following marker comment:
/*
* No longer managed by ElastiCORE. You may modify as needed,
* but retain the marker for traceability.
*/
Marker Meaning
- When this comment is present, ElastiCORE will generate the source only once and will not regenerate it afterward
- Developers can modify the code freely
- It is recommended to keep the marker for traceability
When Regeneration is Needed
When the model (DSL) has changed and code needs to be regenerated:
- Back up the existing generated file
- Delete the file
- Run
./gradlew elcore
# Regeneration procedure
# 1. Backup
cp src/main/java/com/example/entity/User.java src/main/java/com/example/entity/User.java.bak
# 2. Delete
rm src/main/java/com/example/entity/User.java
# 3. Regenerate
./gradlew elcore
warning
Manually added code will be lost during regeneration. Always back up before proceeding.