jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.53k stars 4.02k forks source link

jhipster jdl reactive-mf.jdl no longer works with jhipster v8.1 #24600

Closed vishalgvk closed 10 months ago

vishalgvk commented 10 months ago
Overview of the issue

Downloaded the updated reactive-mf.jdl file. Changed client to angular and db to mariadb. Executed jhipster jdl reactive-mf.jdl --monorepository --workspaces jhipster is generating source code for gateway and store but not for blog app.

Motivation for or Use Case
Reproduce the error

Step 1: Download reactive-mf.jdl Step 2: Changed following values:

Sample:

application {
  config {
    baseName gateway
    reactive true
    packageName com.myapp.gateway
    applicationType gateway
    authenticationType jwt
    buildTool maven
    clientFramework angular
    databaseType sql
    devDatabaseType mariadb
    prodDatabaseType mariadb
    serverPort 8080
    serviceDiscoveryType consul
    testFrameworks [cypress]
    microfrontends [blog, store]
  }
}

application {
  config {
    baseName blog
    reactive true
    packageName com.myapp.blog
    applicationType microservice
    authenticationType jwt
    buildTool maven
    clientFramework angular
    databaseType sql
    devDatabaseType mariadb
    prodDatabaseType mariadb
    enableHibernateCache false
    serverPort 8081
    serviceDiscoveryType consul
    testFrameworks [cypress]
  }
  entities Blog, Post, Tag
}

application {
  config {
    baseName store
    reactive true
    packageName com.myapp.store
    applicationType microservice
    authenticationType jwt
    buildTool maven
    clientFramework angular
    databaseType sql
    devDatabaseType mariadb
    prodDatabaseType mariadb
    enableHibernateCache false
    serverPort 8082
    serviceDiscoveryType consul
    testFrameworks [cypress]
  }
  entities Product
}

Step 3: Execute jhipster jdl reactive-mf.jdl --monorepository --workspaces

Results in:

ERROR! An error occured while running jhipster:bootstrap-application-base#loadingEntities
ERROR! An error occured while running jhipster:workspaces#generateApplications
ERROR! ERROR! Error at entity Blog: could not find the entity user
Error: Error at entity Blog: could not find the entity user
    at loadEntitiesOtherSide (file:///C:/Users/VidyaYug/AppData/Roaming/npm/node_modules/generator-jhipster/dist/generators/base-application/support/relationship.mjs:60:23)
    at BootstrapApplicationBase.loadingEntities (file:///C:/Users/VidyaYug/AppData/Roaming/npm/node_modules/generator-jhipster/dist/generators/bootstrap-application-base/generator.mjs:204:37)
    at BootstrapApplicationBase.executeTask (file:///C:/Users/VidyaYug/AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/yeoman-generator/dist/actions/lifecycle.js:244:26)
    at env.queueTask.once (file:///C:/Users/VidyaYug/AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/yeoman-generator/dist/actions/lifecycle.js:218:56)
    at runLoop.add.once (file:///C:/Users/VidyaYug/AppData/Roaming/npm/node_modules/generator-jhipster/node_modules/yeoman-environment/dist/environment-base.js:384:23)
    at Immediate.<anonymous> (C:\Users\VidyaYug\AppData\Roaming\npm\node_modules\generator-jhipster\node_modules\grouped-queue\lib\subqueue.js:48:34)
    at process.processImmediate (node:internal/timers:476:21)
     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.myapp.store, L=, ST=, C=
     info KeyStore 'C:\Users\VidyaYug\jhipster_workspace\test\store\src\main\resources\config\tls\keystore.p12' generated successfully.
     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.myapp.gateway, L=, ST=, C=
     info KeyStore 'C:\Users\VidyaYug\jhipster_workspace\test\gateway\src\main\resources\config\tls\keystore.p12' generated successfully.
JHipster Version(s)

jhipster version: 8.1.0 node version: 18.19.0

github-actions[bot] commented 10 months ago

JHipster has completed the sample check .yo-rc.json: Entities JDL: Application: successfully generated Frontend check: skipped Backend check: skipped E2E check: skipped

This check uses jhipster info output from the issue description to generate the sample. Bug report that does not contain this information will be marked as invalid.

mshima commented 10 months ago

Samples for main branch are compatible with jhipster v7. You should use the default branch which is the v8 branch for jhipster v8.

vishalgvk commented 10 months ago

Samples for main branch are compatible with jhipster v7. You should use the default branch which is the v8 branch for jhipster v8.

Hi @mshima As you mentioned, I tried with reactive-mf.jdl from v8 branch instead of main. Still the same issue persists for me. Blog code isn't being generated as User entity couldn't be found (in spite of having builtInEntity in the .jdl file)

mshima commented 10 months ago

I've just tried and it worked:

% npx generator-jhipster@8.1.0 jdl reactive-ms --skip-install --monorepository --workspaces

        ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
        ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
        ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝
  ██╗   ██║ ██╔═══██║    ██║    ██╔════╝   ╚═══██╗    ██║    ██╔═══╝   ██╔══██║
  ╚██████╔╝ ██║   ██║ ████████╗ ██║       ██████╔╝    ██║    ████████╗ ██║  ╚██╗
   ╚═════╝  ╚═╝   ╚═╝ ╚═══════╝ ╚═╝       ╚═════╝     ╚═╝    ╚═══════╝ ╚═╝   ╚═╝
                            https://www.jhipster.tech
Welcome to JHipster v8.1.0

INFO! Generating jdls reactive-ms
WARNING! File not found: reactive-ms.jdl. Attempting download from jdl-samples repositoryINFO! Downloading file: https://raw.githubusercontent.com/jhipster/jdl-samples/v8.1.0/reactive-ms.jdl

INFO! Error downloading https://raw.githubusercontent.com/jhipster/jdl-samples/v8.1.0/reactive-ms.jdl: 404 - Not Found
INFO! Downloading file: https://raw.githubusercontent.com/jhipster/jdl-samples/v8/reactive-ms.jdl
.
.
.
Congratulations, JHipster execution is complete!
If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/

Thanks for using JHipster!

Note: jdl command downloads from sample if there is no local file.

vishalgvk commented 10 months ago

Hi @mshima Thanks for your reply I tried the command shared by you: npx generator-jhipster@8.1.0 jdl reactive-ms --skip-install --monorepository --workspaces

I found that using authenticationType as oauth2 instead of jwt (in my case) resolved the issue. So currently, jhipster isn't supporting builtInEntity when we use jwt.

mshima commented 10 months ago

Relationship with User in microservice applications is only supported by oauth2. I don’t think we should support this with jwt and oauth2 implementation should be reimplemented using another technology https://github.com/jhipster/generator-jhipster/issues/18755#issuecomment-1140315937.