Closed deftdawg closed 4 years ago
It seems from further inspection that User entity is actually being ignored with a pair warnings:
warn: The table name 'User' is a reserved keyword for at least one of these applications: testmicroservice, so it will be prefixed with the value of 'jhiPrefix'.
warn: An Entity name 'User' was used: 'User' is an entity created by default by JHipster. All relationships toward it will be kept but any attributes and relationships from it will be disregarded.
Seems one can force the generation by using a dummy NOTUser class and modifying it post generation and then asking JHipster to regenerate... A bit of a brutal way to work around the problem.
Below I'm generating just the classes, if you have custom code better be careful with the rm -rf src
...
jhipster import-jdl ../test.jdl --skip-user-management --ignore-application
# Run a second time as first dies with: ERROR! Cannot read property 'generator-jhipster' of undefined
jhipster import-jdl ../test.jdl --skip-user-management --ignore-application
# Change all references to NOTUser to User
gsed -i 's/NOTUser/User/' .yo-rc.json
sed -e 's/NOTUser/User/' -e 's/not_user/user/' .jhipster/NOTUser.json > .jhipster/User.json && rm .jhipster/NOTUser.json
grep -in not .jhipster/*.json | cut -d: -f1 | xargs -I {} sed -i '' 's/nOTUser/user/' {}
# Verify all changed, grep below should return nothing
grep -in not .* .jhipster/*
# Wipe out source folder
rm -rf src/
# Ask JHipster to regenerate each entity
for entity in $(jq -r ".entities | @tsv" .yo-rc.json); do
jhipster entity $entity --skip-user-management --ignore-application --force
done
# Check that User is created, and we can see it is...
ls -1rth ./src/main/java/com/mycompany/myapp/domain/*.java
./src/main/java/com/mycompany/myapp/domain/package-info.java
./src/main/java/com/mycompany/myapp/domain/AbstractAuditingEntity.java
./src/main/java/com/mycompany/myapp/domain/PersistentAuditEvent.java
./src/main/java/com/mycompany/myapp/domain/User.java
./src/main/java/com/mycompany/myapp/domain/LogEntry.java
Hello, thanks for reporting it. I'm fixing it
Hello, thanks for reporting it. I'm fixing it
...ups, this affects also the JH IDE... I'll create an issue and refer to this.
JH IDE now works as expected, however jhipster import-jdl
still bombs out... It looks like skipUserManagement is either not propagating downward through the levels of generator or not being respected somewhere.
Difficult for me to figure out because I haven't found out how to change the logging level....
(DEBUG=jhipster:* LOG_LEVEL=debug node --inspect /usr/local/Cellar/jhipster/6.10.1/libexec/lib/node_modules/generator-jhipster/cli/cli.js import-jdl ${JDL_FILE} --skip-user-management --ignore-application
didn't work)
Thinking maybe I should open an issue in generator-jhipster and close the one here.
Done in the generator.
Overview of the issue
Unable to generate an application with a custom User entity that has a relationship to other entities because
skipUserManagement
and--skip-user-management
are being ignored.Full stacktrace
Motivation for or Use Case
If I remove the OneToMany relationship JHipster will generate the classes, however it's kind of a useless that a User entity cannot have relationships with any other entities. This is also unexpected because the JDL has no problems rendering in JDL-Studio.
Reproduce the error
Here is the command:
jhipster import-jdl ../test.jdl --skip-user-management --skip-git --ignore-client
Here is the test.jdl file:
Related issues
Suggest a Fix
JHipster Version(s)
JHipster configuration
jhipster info INFO! Using JHipster version installed locally in current project's node_modules INFO! Executing jhipster:info Welcome to the JHipster Information Sub-Generator
JHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions
Environment and Tools
openjdk version "14.0.1" 2020-04-14 OpenJDK Runtime Environment (build 14.0.1+14) OpenJDK 64-Bit Server VM (build 14.0.1+14, mixed mode, sharing)
git version 2.27.0
node: v14.5.0
npm: 6.14.5
Docker version 19.03.12, build 48a6621
identical .jhipster/LogEntry.json INFO! Congratulations, JHipster execution is complete!
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL above
Browsers and Operating System
OSX 10.15.4