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 generator can't regenerate a jdl change #27866

Closed
1 task done
jperezdelafuente opened this issue Nov 12, 2024 · 5 comments
Closed
1 task done

JHipster generator can't regenerate a jdl change #27866

jperezdelafuente opened this issue Nov 12, 2024 · 5 comments

Comments

@jperezdelafuente
Copy link
Contributor

jperezdelafuente commented Nov 12, 2024

Overview of the issue

I can't regenerate the application with changes in jdl
I indicate the 3 steps to reproduce:

  1. I create an application with "jhipster jdl foo.jh" (foo.jh like a JHipster configuration section)
  2. I add an attribute called foo2 to the entity foo (in the file foo.jh)
 /* Foo 2 */
foo2 String required maxlength(30)
  1. I try to regenerate the application with "jhipster jdl foo.jh"

With Node v22.11.0 It finishes without errors and without trying to regenerate the rest of the files

(node:29595) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
     info KeyStore '/home/foo22/src/main/resources/config/tls/keystore.p12' already exists. Leaving unchanged.
[@faker-js/faker]: faker.internet.userName() is deprecated since v9.1.0 and will be removed in v10.0.0. Please use faker.internet.username() instead.
✔ applying multi-step templates
     info Using existing git repository.
identical .prettierrc
identical .prettierignore
✔ prettier configuration files committed to disk
✔ loading translations
✔ updating package.json dependencies versions
✔ prettifying sonar-project.properties
✔ adding package-info.java files
✔ sorting pom.xml file
✔ translating angular application
identical sonar-project.properties
identical .husky/pre-commit
identical src/main/resources/banner.txt
identical .devcontainer/Dockerfile
identical pom.xml
identical src/main/resources/logback-spring.xml
identical src/main/resources/i18n/messages.properties
identical src/test/resources/logback.xml
identical src/test/resources/junit-platform.properties
identical mvnw
identical mvnw.cmd
identical .mvn/wrapper/maven-wrapper.jar
identical .mvn/wrapper/maven-wrapper.properties
identical .mvn/jvm.config
identical src/main/docker/jib/entrypoint.sh
identical checkstyle.xml

With Node v20.18.0 finishes with errors and without trying to regenerate the rest of the files:

     info KeyStore '/home/foo20/src/main/resources/config/tls/keystore.p12' already exists. Leaving unchanged.
[@faker-js/faker]: faker.internet.userName() is deprecated since v9.1.0 and will be removed in v10.0.0. Please use faker.internet.username() instead.
✔ applying multi-step templates
     info Using existing git repository.
identical .prettierrc
identical .prettierignore
✔ prettier configuration files committed to disk
✔ loading translations
✔ updating package.json dependencies versions
✔ prettifying sonar-project.properties
✔ adding package-info.java files
✔ sorting pom.xml file
✔ translating angular application
identical sonar-project.properties
identical .husky/pre-commit
identical src/main/resources/banner.txt
identical .devcontainer/Dockerfile
identical pom.xml
identical src/main/resources/logback-spring.xml
identical src/main/resources/i18n/messages.properties
identical src/test/resources/logback.xml
identical src/test/resources/junit-platform.properties
identical mvnw
identical mvnw.cmd
identical .mvn/wrapper/maven-wrapper.properties
identical .mvn/wrapper/maven-wrapper.jar
identical .mvn/jvm.config
identical src/main/docker/jib/entrypoint.sh
identical checkstyle.xml
**ERROR! ERROR! Cannot read properties of undefined (reading 'added')
TypeError: Cannot read properties of undefined (reading 'added')
    at Conflicter._detectConflict (file:///home/.nvm/versions/node/v20.18.0/lib/node_modules/generator-jhipster/node_modules/@yeoman/conflicter/dist/conflicter.js:182:58)
    at async Conflicter._checkForCollision (file:///home/.nvm/versions/node/v20.18.0/lib/node_modules/generator-jhipster/node_modules/@yeoman/conflicter/dist/conflicter.js:260:13)
    at async Conflicter.checkForCollision (file:///home/.nvm/versions/node/v20.18.0/lib/node_modules/generator-jhipster/node_modules/@yeoman/conflicter/dist/conflicter.js:205:20)
    at async Object. (file:///home/.nvm/versions/node/v20.18.0/lib/node_modules/generator-jhipster/node_modules/@yeoman/conflicter/dist/conflicter.js:391:36)
    at async file:///home/.nvm/versions/node/v20.18.0/lib/node_modules/generator-jhipster/node_modules/p-transform/dist/queue.js:68:28
    at async file:///home/.nvm/versions/node/v20.18.0/lib/node_modules/generator-jhipster/node_modules/p-queue/dist/index.js:187:36**

With Node v18.20.4 finishes with errors and without trying to regenerate the rest of the files:

          info KeyStore '/home/foo18/src/main/resources/config/tls/keystore.p12' already exists. Leaving unchanged.
[@faker-js/faker]: faker.internet.userName() is deprecated since v9.1.0 and will be removed in v10.0.0. Please use faker.internet.username() instead.
✔ applying multi-step templates
     info Using existing git repository.
identical .prettierrc
identical .prettierignore
✔ prettier configuration files committed to disk
✔ loading translations
✔ updating package.json dependencies versions
✔ prettifying sonar-project.properties
✔ adding package-info.java files
✔ sorting pom.xml file
✔ translating angular application
identical sonar-project.properties
identical .husky/pre-commit
identical src/main/resources/banner.txt
identical .devcontainer/Dockerfile
identical pom.xml
identical src/main/resources/logback-spring.xml
identical src/main/resources/i18n/messages.properties
identical src/test/resources/logback.xml
identical src/test/resources/junit-platform.properties
identical mvnw
identical mvnw.cmd
identical .mvn/wrapper/maven-wrapper.jar
identical .mvn/wrapper/maven-wrapper.properties
identical .mvn/jvm.config
identical src/main/docker/jib/entrypoint.sh
identical checkstyle.xml
ERROR! ERROR! Cannot read properties of undefined (reading 'added')
TypeError: Cannot read properties of undefined (reading 'added')
    at Conflicter._detectConflict (file:///home/.nvm/versions/node/v18.20.4/lib/node_modules/generator-jhipster/node_modules/@yeoman/conflicter/dist/conflicter.js:182:58)
    at async Conflicter._checkForCollision (file:///home/.nvm/versions/node/v18.20.4/lib/node_modules/generator-jhipster/node_modules/@yeoman/conflicter/dist/conflicter.js:260:13)
    at async Conflicter.checkForCollision (file:///home/.nvm/versions/node/v18.20.4/lib/node_modules/generator-jhipster/node_modules/@yeoman/conflicter/dist/conflicter.js:205:20)
    at async Object. (file:///home/.nvm/versions/node/v18.20.4/lib/node_modules/generator-jhipster/node_modules/@yeoman/conflicter/dist/conflicter.js:391:36)
    at async file:///home/.nvm/versions/node/v18.20.4/lib/node_modules/generator-jhipster/node_modules/p-transform/dist/queue.js:68:28
    at async file:///home/.nvm/versions/node/v18.20.4/lib/node_modules/generator-jhipster/node_modules/p-queue/dist/index.js:187:36
Motivation for or Use Case

Perform regenerations in the application with changes in the jdl

Reproduce the error
Related issues
Suggest a Fix
JHipster Version(s)

8.7.3

JHipster configuration

To provide all information we need, you should run jhipster info in the project root folder (or workspaces root for microservices), and
copy/paste the result here.
jhipster info removes sentitive information like rememberKey, jwtSecretKey. Double check if there is any other sensitive info.

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "session",
    "baseName": "foo",
    "buildTool": "maven",
    "cacheProvider": "ehcache",
    "clientFramework": "angular",
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "devServerPort": 4200,
    "enableHibernateCache": true,
    "enableTranslation": true,
    "entities": [
      "Foo"
    ],
    "jhiPrefix": "gsr",
    "jhipsterVersion": "8.7.3",
    "languages": [
      "es",
      "en"
    ],
    "lastLiquibaseTimestamp": 1731401631000,
    "nativeLanguage": "es",
    "packageName": "com.foo",
    "prodDatabaseType": "oracle",
    "testFrameworks": [
      "cypress",
      "gatling",
      "cucumber"
    ]
  }
}
Environment and Tools

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

git version 2.34.1

node: v22.11.0
npm: 10.9.0

Docker version 24.0.2, build cb74dfc

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
/**
 * Entity Foo
 */
@ChangelogDate("20241112085351")
entity Foo {
  foo String required maxlength(20)
}

dto Foo with mapstruct
paginate Foo with pagination
service Foo with serviceImpl
search Foo with no

As alternative you can add a JDL wrapped in below structure

JDL definitions
 application {
  config {
    applicationType monolith,
    baseName foo,
    packageName com.foo,
    jhiPrefix gsr,
    authenticationType session,
    databaseType sql,
    devDatabaseType h2Disk,
    prodDatabaseType oracle,
    enableHibernateCache true,
    cacheProvider ehcache,
    buildTool maven,
    testFrameworks [cypress, gatling, cucumber],
    clientFramework angular,
    enableTranslation true,
    nativeLanguage es,
    languages [es, en]
  }
  entities *
}

/** Entity Foo */

entity Foo(foo) {

/* Foo */
foo String required maxlength(20)

}

dto * with mapstruct

service all with serviceImpl

paginate all with pagination

The information is mandatory for bug reports. This will allow us to use automated tests and genarate the broken sample using jhipster from-issue command.

Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@mshima
Copy link
Member

mshima commented Nov 20, 2024

@jperezdelafuente please open a new issue with incremental jdls so CI can test.

@DanielFran
Copy link
Member

Duplicated with #27944

@jperezdelafuente
Copy link
Contributor Author

I think the issue is very blocking and should be fixed in a new version 8.7.4 without waiting for 8.8.0 (due to updates to Spring Boot 3.4 and Angular 19)

@mshima
Copy link
Member

mshima commented Dec 2, 2024

@jperezdelafuente the issue looks very specific.
Workarounds:

  • use --force
  • use npm overrides to update @yeoman/conflicter package locally and use local install.

@jperezdelafuente
Copy link
Contributor Author

with --force run OK

@mraible mraible added this to the 8.8.0 milestone Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants