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

jdl blueprint errors when generating sample application using dev blueprint #25489

Closed
1 task done
dwarakaprasad opened this issue Mar 14, 2024 · 3 comments · Fixed by #25497
Closed
1 task done

jdl blueprint errors when generating sample application using dev blueprint #25489

dwarakaprasad opened this issue Mar 14, 2024 · 3 comments · Fixed by #25497

Comments

@dwarakaprasad
Copy link
Contributor

Overview of the issue

A jdl blueprint errors when run using the .blueprint/generators/generate-sample/generator.mjs
command: jhipster-<blueprintName> generate-sample sample.jdl

No change to package.json was detected. No package manager install will be executed.
ERROR! An error occured while running jhipster-adikkal:jdl#checkOptions
ERROR! ERROR! At least one jdl file is required.
Error: At least one jdl file is required.
    at default.checkOptions (file:///home/dwarka/develop/code/brmaStr/basepack/generator-jhipster-adikkal/node_modules/generator-jhipster/dist/generators/jdl/generator.js:88:27)
    at default.executeTask (file:///home/dwarka/develop/code/brmaStr/basepack/generator-jhipster-adikkal/node_modules/yeoman-generator/dist/actions/lifecycle.js:244:26)
    at env.queueTask.once (file:///home/dwarka/develop/code/brmaStr/basepack/generator-jhipster-adikkal/node_modules/yeoman-generator/dist/actions/lifecycle.js:218:56)
    at runLoop.add.once (file:///home/dwarka/develop/code/brmaStr/basepack/generator-jhipster-adikkal/node_modules/yeoman-environment/dist/environment-base.js:395:23)
    at Immediate.<anonymous> (/home/dwarka/develop/code/brmaStr/basepack/generator-jhipster-adikkal/node_modules/grouped-queue/lib/subqueue.js:48:34)
    at process.processImmediate (node:internal/timers:478:21)
Motivation for or Use Case

It should be possible to use generate-sample devBlueprint to generate samples.

Reproduce the error

Create a blueprint for jdl and try running the command
jhipster-<blueprintName> generate-sample sample.jdl

Related issues

None.

Suggest a Fix

Change this to

await this.composeWithBlueprints('jdl', { generatorArgs: (this.options as any).jdlFiles });

similar to language generator

jdl generator can be composed as follows,

await this.composeWithJHipster('jdl', {
          generatorArgs: [this.sampleName],
          generatorOptions: {
            skipJhipsterDependencies: true,
            skipInstall: true,
            jdlFiles: [ this.sampleName ],
          },
        });
JHipster Version(s)

main branch

JHipster configuration
.yo-rc.json file
{
  "generator-jhipster": {
    "additionalSubGenerators": "",
    "baseName": "testblue",
    "cli": true,
    "entities": [],
    "generators": {
      "jdl": {
        "command": false,
        "priorities": [
          "initializing",
          "prompting",
          "configuring",
          "composing",
          "loading",
          "preparing",
          "configuringEachEntity",
          "loadingEntities",
          "preparingEachEntity",
          "preparingEachEntityField",
          "preparingEachEntityRelationship",
          "postPreparingEachEntity",
          "default",
          "writing",
          "writingEntities",
          "postWriting",
          "postWritingEntities",
          "loadingTranslations",
          "install",
          "postInstall",
          "end"
        ],
        "sbs": false,
        "written": true
      },
    },
    "jhipsterVersion": "8.1.0",
    "localBlueprint": false,
    "sampleWritten": true,
    "subGenerators": [
      "jdl"
    ]
  }
}
Environment and Tools

openjdk version "17.0.8" 2023-07-18
OpenJDK Runtime Environment Temurin-17.0.8+7 (build 17.0.8+7)
OpenJDK 64-Bit Server VM Temurin-17.0.8+7 (build 17.0.8+7, mixed mode, sharing)

git version 2.34.1

node: v20.11.1
npm: 10.2.4

Docker version 25.0.3, build 4debf41

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

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@mshima
Copy link
Member

mshima commented Mar 15, 2024

The languages implementation was old when args and options were defined in constructor.
#25497 should be a more generic solution.

@mshima
Copy link
Member

mshima commented Mar 15, 2024

@dwarakaprasad let me know if the solution is ok.

@dwarakaprasad
Copy link
Contributor Author

@dwarakaprasad let me know if the solution is ok.

@mshima this is much better than what I had suggested. I was a little hesitant to use _agrs (although it was used in parseJHipsterArguments) from yeoman. Your solution has fixed the problem for all blueprint generators. This is great and thank you so much.

I tested both cli & generate-sample, both works like a charm. Once again thank you so much...

@deepu105 deepu105 added this to the 8.2.0 milestone Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants