Closed berndwaibel closed 9 months ago
To regenerate with entities you need --with-entities
option.
I confirm having the same issue. If you generate entities from jdl twice without any modification the second time it will :
But if you generate entities from jdl a second time with a new entity in the jdl :
I did my tests in an existing project so if you do not succeed to reproduce it I can try in a brand new project to give additional information.
Command used : jhipster jdl example.jdl During generation, all files are overriden when it was asked
Environment:
java version "17.0.2" 2022-01-18 LTS Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86) Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)
JHipster 7.9.3 npm 9.6.6 node 16.20.0
This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days
Overview of the issue
When running the jhipster jdl generator twice, all Entities are removed on second run from Navigation bar. So the created Entites List in the generated Angular Frontend is empty.
Motivation for or Use Case
When I add new Entities, I will run the jhipster generator again to add the new entries. But he removes als entries from generated navbar.
Reproduce the error
Generate any jhipster jdl file, for example using the JDL GUI examples at (https://start.jhipster.tech/jdl-studio/). Call the file "jhipster-jdl.jdl" (name does not matter, but is following used. The file should be related to microservices, and should contain applications and entities.
I am using git bash on Windows for following commands.
The following files are changed: modified: testGateway/src/main/resources/config/liquibase/master.xml modified: testGateway/src/main/webapp/app/entities/entity-navbar-items.ts modified: testGateway/src/main/webapp/app/entities/entity-routing.module.ts modified: testGateway/src/main/webapp/app/layouts/navbar/navbar.component.html modified: testGateway/src/main/webapp/i18n/en/global.json modified: testService/src/main/java/de/bwaibel/test/config/CacheConfiguration.java modified: testService/src/main/resources/config/liquibase/master.xml
If you use " jhipster jdl --ignore-application jhipster-jdl.jdl" instead, no error happens, as nothing will be regenerated.
If you use "jhipster jdl jhipster-jdl.jdl", all entities are removed from applications.
Related issues
Related bug, closed without change, is here: https://github.com/jhipster/generator-jhipster/issues/5192
Suggest a Fix
When running the jdl generator twice, and applicaton and entities exists already, do not regenerate the components listed above. Or regenerate the entites too.
JHipster Version(s)
JHipster v7.9.2 JHipster Generator Version
JHipster configuration
INFO! Using bundled JHipster Welcome to JHipster v7.9.2
Welcome to the JHipster Information Sub-Generator
cat: no such file or directory: .yo-rc.json
JHipster configuration, a
.yo-rc.json
file generated in the root folderThis is from gateway:
.yo-rc.json file
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryEnvironment and Tools
openjdk version "17.0.2" 2022-01-18 OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8) OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)
git version 2.35.1.windows.2
node: v18.12.1
npm: 8.19.2
Docker version 20.10.21-rd, build ac29474
Docker Compose version v2.14.0
No change to package.json was detected. No package manager install will be executed. Congratulations, JHipster execution is complete!
INFO: The json Files are created in the subdirectories of the gateway and the service, so not listed here.
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryThis is from Gateway:
JDL entity definitions Person.json
JDL entity definitions Address.json
JDL entity definitions UserRegistration.json
JDL File
jhipster-jdl.jdl file
Browsers and Operating System
Windows 10, all browser behave the same (as the source code is missing the entities).