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.56k stars 4.02k forks source link

spring-data-relational blueprint test failure #25391

Closed dwarakaprasad closed 8 months ago

dwarakaprasad commented 8 months ago
Overview of the issue

spring-data-blueprint test fails with the following exception,

FAIL  generators/spring-data-relational/generator.spec.mjs > SubGenerator spring-data-relational of basepack JHipster blueprint > run
ReferenceError: /home/dwarka/develop/code/brmaStr/basepack/jhipster-basepack/node_modules/generator-jhipster/dist/generators/spring-data-relational/templates/src/main/java/_package_/config/DatabaseConfiguration.java.ejs:90
    88| @EnableR2dbcRepositories({<%- domains.map(domain => `"${domain}.repository"`).join(', ') %>})
    89| <%_ } else { _%>
 >> 90| @EnableJpaRepositories({<%- domains.map(domain => `"${domain}.repository"`).join(', ') %>})
    91| @EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware")
    92| <%_ } _%>
    93| @EnableTransactionManagement

domains is not defined
 ❯ default.eval "/home/dwarka/develop/code/brmaStr/basepack/jhipster-basepack/node_modules/generator-jhipster/dist/generators/spring-data-relational/templates/src/main/java/_package_/config/DatabaseConfiguration.java.ejs":92:17
 ❯ DatabaseConfiguration.java node_modules/ejs/lib/ejs.js:703:17
 ❯ node_modules/ejs/lib/ejs.js:260:40
 ❯ tryHandleCache node_modules/ejs/lib/ejs.js:258:14
 ❯ Object.exports.renderFile node_modules/ejs/lib/ejs.js:491:10
 ❯ renderFile node_modules/mem-fs-editor/dist/util.js:65:16
 ❯ MemFsEditor.processFile node_modules/mem-fs-editor/dist/actions/copy-tpl-async.js:13:20
 ❯ MemFsEditor.applyProcessingFileFunc node_modules/mem-fs-editor/dist/actions/copy-async.js:10:54
 ❯ MemFsEditor._copySingleAsync node_modules/mem-fs-editor/dist/actions/copy-async.js:76:52
Motivation for or Use Case

It should be possible to extend spring-data-relational generator.

Reproduce the error

use the attached .yo-rc.json to generate a blueprint and you can see the failure.

Related issues

none

Suggest a Fix
JHipster Version(s)

8.1.0

JHipster configuration
.yo-rc.json file
{
  "generator-jhipster": {
    "additionalSubGenerators": "",
    "baseName": "basepack",
    "cli": true,
    "entities": [],
    "generators": {
      "spring-cloud-stream": {
        "command": true,
        "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
      },
      "spring-data-cassandra": {
        "command": true,
        "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
      },
      "spring-data-couchbase": {
        "command": true,
        "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
      },
      "spring-data-elasticsearch": {
        "command": true,
        "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
      },
      "spring-data-mongodb": {
        "command": true,
        "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
      },
      "spring-data-neo4j": {
        "command": true,
        "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
      },
      "spring-data-relational": {
        "command": true,
        "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
      },
      "spring-websocket": {
        "command": true,
        "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,
    "skipCommitHook": true,
    "subGenerators": [
      "spring-cloud-stream",
      "spring-data-cassandra",
      "spring-data-couchbase",
      "spring-data-elasticsearch",
      "spring-data-mongodb",
      "spring-data-neo4j",
      "spring-data-relational",
      "spring-websocket"
    ]
  }
}
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: v18.19.0 npm: 10.2.3

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
mshima commented 8 months ago

This part can be moved to Java generator: https://github.com/jhipster/generator-jhipster/blob/a2a4016d60a0feb1a443bbea5194e1a8f114b0e3/generators/server/generator.js#L564-L568

and the relational generator can depend on Java or spring-boot https://github.com/jhipster/generator-jhipster/blob/4d8ad04a98f314028169db10302a74c4e9302bbf/generators/spring-data-relational/generator.ts#L48

dwarakaprasad commented 8 months ago

yup thanks for your review, will update.

dwarakaprasad commented 8 months ago

This part can be moved to Java generator:

https://github.com/jhipster/generator-jhipster/blob/a2a4016d60a0feb1a443bbea5194e1a8f114b0e3/generators/server/generator.js#L564-L568

and the relational generator can depend on Java or spring-boot

https://github.com/jhipster/generator-jhipster/blob/4d8ad04a98f314028169db10302a74c4e9302bbf/generators/spring-data-relational/generator.ts#L48

Done