Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jhipster project creation sets wrong default values on .yo-rc.json #22978

Closed
joaocarloscg opened this issue Jul 26, 2023 · 0 comments · Fixed by #23010
Closed

jhipster project creation sets wrong default values on .yo-rc.json #22978

joaocarloscg opened this issue Jul 26, 2023 · 0 comments · Fixed by #23010

Comments

@joaocarloscg
Copy link

joaocarloscg commented Jul 26, 2023

When creating a fresh newly project, follows the answers I did for the project:

C:>cd C:\var\asd
C:\var\asd>jhipster

Welcome to JHipster v8.0.0-beta.2

? What is the base name of your application? asd
? Which type of application would you like to create? Monolithic application (recommended for simple projects)
? Would you like to enable internationalization support? Yes
? Please choose the native language of the application Portuguese
? Please choose additional languages to install English
? Do you want to make it reactive with Spring WebFlux? Yes
? What is your default Java package name? com.test
? Which type of authentication would you like to use? JWT authentication (stateless, with a token)
? Which type of database would you like to use? SQL (H2, PostgreSQL, MySQL, MariaDB, MSSQL)
? Which production database would you like to use? PostgreSQL
? Which development database would you like to use? H2 with disk-based persistence
? Would you like to use Maven or Gradle for building the backend? Maven
? Which other technologies would you like to use?
? Which Framework would you like to use for the client? Angular
? Do you want to generate the admin UI? Yes
? Would you like to use a Bootswatch theme (https://bootswatch.com/)? Default JHipster
? Besides JUnit and Jest, which testing frameworks would you like to use?
info Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 99,999 days
info for: CN=Java Hipster, OU=Development, O=com.test, L=, ST=, C=
info KeyStore 'C:\var\asd\src\main\resources\config\tls\keystore.p12' generated successfully.
...

Right after the project is created, without any changes, I've just run the following, and follows the error I'm getting:

C:\var\asd>jhipster export-jdl test.jh
WARNING! Since JHipster v8, the jhipster command will not use the locally installed generator-jhipster.
If you want to execute the locally installed generator-jhipster, run: npx jhipster

Welcome to JHipster v8.0.0-beta.2

ERROR! An error occured while running jhipster:export-jdl#convertToJDL
ERROR! ERROR! An error occurred while exporting to JDL: Unknown value 'null' for option 'cacheProvider'.
Error: Unknown value 'null' for option 'cacheProvider'.
Error: An error occurred while exporting to JDL: Unknown value 'null' for option 'cacheProvider'.
Error: Unknown value 'null' for option 'cacheProvider'.

at default.convertToJDL (file:///C:/Users/canixe/AppData/Roaming/npm/node_modules/generator-jhipster/dist/generators/export-jdl/generator.mjs:54:27)
at default.executeTask (file:///C:/Users/canixe/AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/yeoman-generator/dist/actions/lifecycle.js:240:26)
at env.queueTask.once (file:///C:/Users/canixe/AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/yeoman-generator/dist/actions/lifecycle.js:214:56)
at runLoop.add.once (file:///C:/Users/canixe/AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/yeoman-environment/dist/environment-base.js:383:23)
at Immediate. (C:\Users\canixe\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\grouped-queue\lib\subqueue.js:48:34)
at process.processImmediate (node:internal/timers:471:21)

I've checked the file .yo-rc.json, and seems like the cacheProvider is set to null, and there were no questions on project creation regarding the cache I want, as you can see above on the first set, not sure if the bug would be having no question, since it is mentioned here: https://www.jhipster.tech/creating-an-app/

{
"generator-jhipster": {
"applicationType": "monolith",
"authenticationType": "jwt",
"baseName": "asd",
"buildTool": "maven",
"cacheProvider": null,
"clientFramework": "angular",
"clientTheme": "none",
"creationTimestamp": 1690343560878,
"databaseType": "sql",
"devDatabaseType": "h2Disk",
"devServerPort": 4200,
"dtoSuffix": "DTO",
"enableGradleEnterprise": null,
"enableHibernateCache": null,
"enableSwaggerCodegen": false,
"enableTranslation": true,
"entities": [],
"entitySuffix": "",
"gradleEnterpriseHost": null,
"jhiPrefix": "jhi",
"jhipsterVersion": "8.0.0-beta.2",
"jwtSecretKey": "",
"languages": ["pt-pt", "en", "fr"],
"messageBroker": false,
"microfrontend": false,
"microfrontends": [],
"nativeLanguage": "pt-pt",
"packageFolder": "com/test",
"packageName": "com.test",
"pages": [],
"prodDatabaseType": "postgresql",
"reactive": true,
"searchEngine": false,
"serverPort": null,
"serverSideOptions": [],
"serviceDiscoveryType": false,
"skipCheckLengthOfIdentifier": false,
"skipClient": false,
"skipFakeData": false,
"skipUserManagement": false,
"testFrameworks": [],
"websocket": false,
"withAdminUi": true
}
}

I believe for a newly created project, the export-jdl shouldn't crash.
Follows the Info:

C:\var\asd>jhipster info
WARNING! Since JHipster v8, the jhipster command will not use the locally installed generator-jhipster.
If you want to execute the locally installed generator-jhipster, run: npx jhipster

Welcome to JHipster v8.0.0-beta.2

Welcome to the JHipster Information Sub-Generator

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "applicationType": "monolith",
  "authenticationType": "jwt",
  "baseName": "asd",
  "buildTool": "maven",
  "cacheProvider": null,
  "clientFramework": "angular",
  "clientTheme": "none",
  "creationTimestamp": 1690343560878,
  "databaseType": "sql",
  "devDatabaseType": "h2Disk",
  "devServerPort": 4200,
  "dtoSuffix": "DTO",
  "enableGradleEnterprise": null,
  "enableHibernateCache": null,
  "enableSwaggerCodegen": false,
  "enableTranslation": true,
  "entities": [],
  "entitySuffix": "",
  "gradleEnterpriseHost": null,
  "jhiPrefix": "jhi",
  "jhipsterVersion": "8.0.0-beta.2",
  "languages": [
    "pt-pt",
    "en",
    "fr"
  ],
  "messageBroker": false,
  "microfrontend": false,
  "microfrontends": [],
  "nativeLanguage": "pt-pt",
  "packageFolder": "com/test",
  "packageName": "com.test",
  "pages": [],
  "prodDatabaseType": "postgresql",
  "reactive": true,
  "searchEngine": false,
  "serverPort": null,
  "serverSideOptions": [],
  "serviceDiscoveryType": false,
  "skipCheckLengthOfIdentifier": false,
  "skipClient": false,
  "skipFakeData": false,
  "skipUserManagement": false,
  "testFrameworks": [],
  "websocket": false,
  "withAdminUi": true
}
Environment and Tools

java version "17.0.1" 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

git version 2.35.0.windows.1

node: v18.13.0
npm: 9.8.1

Docker version 24.0.2, build cb74dfc

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

√ applying multi-step templates
info Multiple customCommitTask tasks found (C:\var\asd#jhipster:info, jhipster:bootstrap). Using the first.

Congratulations, JHipster execution is complete!
If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/

Sponsored with ❤️ by @oktadev.C:\var\asd>jhipster info
WARNING! Since JHipster v8, the jhipster command will not use the locally installed generator-jhipster.
If you want to execute the locally installed generator-jhipster, run: npx jhipster

Welcome to JHipster v8.0.0-beta.2

Welcome to the JHipster Information Sub-Generator

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "applicationType": "monolith",
  "authenticationType": "jwt",
  "baseName": "asd",
  "buildTool": "maven",
  "cacheProvider": null,
  "clientFramework": "angular",
  "clientTheme": "none",
  "creationTimestamp": 1690343560878,
  "databaseType": "sql",
  "devDatabaseType": "h2Disk",
  "devServerPort": 4200,
  "dtoSuffix": "DTO",
  "enableGradleEnterprise": null,
  "enableHibernateCache": null,
  "enableSwaggerCodegen": false,
  "enableTranslation": true,
  "entities": [],
  "entitySuffix": "",
  "gradleEnterpriseHost": null,
  "jhiPrefix": "jhi",
  "jhipsterVersion": "8.0.0-beta.2",
  "languages": [
    "pt-pt",
    "en",
    "fr"
  ],
  "messageBroker": false,
  "microfrontend": false,
  "microfrontends": [],
  "nativeLanguage": "pt-pt",
  "packageFolder": "com/test",
  "packageName": "com.test",
  "pages": [],
  "prodDatabaseType": "postgresql",
  "reactive": true,
  "searchEngine": false,
  "serverPort": null,
  "serverSideOptions": [],
  "serviceDiscoveryType": false,
  "skipCheckLengthOfIdentifier": false,
  "skipClient": false,
  "skipFakeData": false,
  "skipUserManagement": false,
  "testFrameworks": [],
  "websocket": false,
  "withAdminUi": true
}
Environment and Tools

java version "17.0.1" 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

git version 2.35.0.windows.1

node: v18.13.0
npm: 9.8.1

Docker version 24.0.2, build cb74dfc

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

√ applying multi-step templates
info Multiple customCommitTask tasks found (C:\var\asd#jhipster:info, jhipster:bootstrap). Using the first.

Congratulations, JHipster execution is complete!
If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/

Sponsored with ❤️ by @oktadev.

From what I see here: https://github.com/jhipster/generator-jhipster/blob/main/jdl/jhipster/application-options.ts
And here: https://github.com/jhipster/generator-jhipster/blob/main/jdl/jhipster/cache-types.ts
The default value should be "no"

And if I manually ammend the file .yo-rc.json, a similar issue happens with other fields, it seems the default values were not set correctly on the project creation maybe?
cacheProvider defaults to null instead of "no"
messageBroker defaults to false instead of "no"
searchEngine defaults to false instead of "no"
serviceDiscoveryType defaults to false instead of "no"
websocket defaults to false instead of "no"
gradleEnterpriseHost defaults to null instead of "" (this one causes a different error message: "Cannot read properties of null (reading 'includes')", this happens because string properties come here: https://github.com/jhipster/generator-jhipster/blob/v8.0.0-beta.2/jdl/models/jdl-application-definition.ts -> shouldTheValueBeQuoted)

@joaocarloscg joaocarloscg changed the title jhipster export-jdl broken on newly created project jhipster project creation sets wrong default values on .yo-rc.json Jul 26, 2023
@deepu105 deepu105 added this to the 8.0.0-beta.3 milestone Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants