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

JHipster doesn't show the correct errors #9739

Closed hizmarck closed 5 years ago

hizmarck commented 5 years ago
Overview of the issue

I had used JHipster online to generate .jh file, when I used the option "Apply", then I got this response:

Sending request to the server...
JDL Model is going to be applied to neuronatech/trkact-platform
Cloning GitLab repository 'neuronatech/trkact-platform'
Creating branch 'jhipster-entities-zufikon2-953723155901196'
Adding JDL file into the project
Generating entities from JDL Model
Running 'jhipster import-jdl
INFO! Using JHipster version installed globally
INFO! Executing import-jdl zufikon2.jh
INFO! Options: forceInsight: true, skipChecks: true, skipInstall: true, force: true, from-cli: true, force-insight: true, skip-checks: true, skip-install: true
INFO! Found .yo-rc.json on path. This is an existing app
INFO! The JDL is being parsed.
INFO! Found entities: ItemLocation, Building, TraceableElement, Area, Movement, Zone, Product, UnitMeasure, Task, LogTask, ItemZF, LogTaskDetail.
INFO! The JDL has been successfully parsed
INFO! Generating 12 entities.
INFO! Congratulations, JHipster execution is complete!
Pushing the application to the GitLab remote repository
Application successfully pushed!
Creating Merge Request
Merge Request created at https://gitlab.com/neuronatech/trkact-platform/merge_requests/32
Generation finished

When I checked the generated branch, and compare with my actual branch:

Screenshot from 2019-05-13 15-32-59

How can you see, the classes didn't generate right.

Motivation for or Use Case

Well, How you can see, JHipster online doesn't show me that error happened.

Reproduce the error

Used JHipster Online with this diagram:

entity ItemLocation {}

entity Building {
    name String required,
    description String required,
}

entity TraceableElement {
    qr String required,
    key String required,
    lat BigDecimal required,
    lgn BigDecimal required,
    alt BigDecimal required
}

entity Area {
    name String required,
    description String required,
}

enum MovementType {
    INM, OUT
}

entity Movement {
    folio String required,
    date ZonedDateTime required,
    typeMovement MovementType
}

entity Zone {
    name String required,
    description String required,
}

entity Product {
    name String required,
    key String required,
    description String
}

entity UnitMeasure {
    name String required,
    description String
}

entity Task {
    name String required,
    estimatedStartTask ZonedDateTime required,
    estimatedEndTask ZonedDateTime required,
    description String required,
}

entity LogTask {
    lat BigDecimal required,
    lgn BigDecimal required,
    alt BigDecimal required,
    imgStartTask String required,
    imgEndTask String required,
    startDate ZonedDateTime required,
    endDate ZonedDateTime,
    observations String
}

entity ItemZF{
    coverImg String,
    estimatedUsefulLifeDay BigDecimal
}

entity LogTaskDetail {
    quantity BigDecimal
}

// Set pagination options
paginate * with pagination

// Use Data Transfert Objects (DTO)
// dto * with mapstruct

// Set service options to all except few
service all with serviceImpl

// Set an angular suffix
// angularSuffix * with mySuffix

yo-rc.json

{
  "generator-jhipster": {
    "applicationType": "monolith",
    "gitCompany": "",
    "baseName": "trkactPlatform",
    "packageName": "io.zufikon.trkact.application",
    "packageFolder": "io/zufikon/trkact/application",
    "serverPort": 8080,
    "serviceDiscoveryType": false,
    "authenticationType": "oauth2",
    "uaaBaseName": "../uaa",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "prodDatabaseType": "postgresql",
    "searchEngine": false,
    "enableSwaggerCodegen": "true",
    "messageBroker": false,
    "buildTool": "maven",
    "useSass": true,
    "clientPackageManager": "npm",
    "testFrameworks": [],
    "enableTranslation": true,
    "nativeLanguage": "es",
    "languages": [
      "en",
      "es"
    ],
    "clientFramework": "angularX",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "6.0.0",
    "clientTheme": "none",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": []
  },
  "git-provider": "GitLab",
  "git-company": "neuronatech",
  "repository-name": "trkact-platform"
}
Related issues
Suggest a Fix

I changed the name of entity 'LogTaskDetail' to -> 'LogTaskDetailZF'

JHipster Version(s)
JHipster configuration

package.json

{
  "name": "trkact-platform",
  "version": "0.0.0",
  "description": "Description for trkactPlatform",
  "private": true,
  "license": "UNLICENSED",
  "cacheDirectories": [
    "node_modules"
  ],
  "dependencies": {
    "@angular/common": "7.2.12",
    "@angular/compiler": "7.2.12",
    "@angular/core": "7.2.12",
    "@angular/forms": "7.2.12",
    "@angular/platform-browser": "7.2.12",
    "@angular/platform-browser-dynamic": "7.2.12",
    "@angular/router": "7.2.12",
    "@fortawesome/angular-fontawesome": "0.3.0",
    "@fortawesome/fontawesome-svg-core": "1.2.17",
    "@fortawesome/free-solid-svg-icons": "5.8.1",
    "@ng-bootstrap/ng-bootstrap": "4.1.1",
    "@ngx-translate/core": "11.0.1",
    "@ngx-translate/http-loader": "4.0.0",
    "bootstrap": "4.3.1",
    "core-js": "2.6.5",
    "moment": "2.24.0",
    "ng-jhipster": "0.9.3",
    "ngx-cookie": "4.0.2",
    "ngx-infinite-scroll": "7.1.0",
    "ngx-webstorage": "3.0.2",
    "rxjs": "6.4.0",
    "swagger-ui": "2.2.10",
    "sockjs-client": "1.3.0",
    "webstomp-client": "1.2.6",
    "tslib": "1.9.3",
    "zone.js": "0.8.29"
  },
  "devDependencies": {
    "@angular/cli": "7.3.8",
    "@angular/compiler-cli": "7.2.12",
    "@ngtools/webpack": "7.3.8",
    "@types/jest": "24.0.11",
    "@types/node": "10.12.27",
    "angular-router-loader": "0.8.5",
    "angular2-template-loader": "0.6.2",
    "autoprefixer": "9.5.0",
    "base-href-webpack-plugin": "2.0.0",
    "browser-sync": "2.26.5",
    "browser-sync-webpack-plugin": "2.2.2",
    "cache-loader": "2.0.1",
    "codelyzer": "5.0.0",
    "copy-webpack-plugin": "5.0.2",
    "css-loader": "2.1.1",
    "file-loader": "3.0.1",
    "fork-ts-checker-webpack-plugin": "1.0.1",
    "friendly-errors-webpack-plugin": "1.7.0",
    "generator-jhipster": "6.0.0",
    "html-loader": "0.5.5",
    "html-webpack-plugin": "3.2.0",
    "husky": "1.3.1",
    "jest": "24.7.1",
    "jest-junit": "6.3.0",
    "jest-preset-angular": "7.0.1",
    "jest-sonar-reporter": "2.0.0",
    "lint-staged": "8.1.5",
    "merge-jsons-webpack-plugin": "1.0.18",
    "mini-css-extract-plugin": "0.5.0",
    "moment-locales-webpack-plugin": "1.0.7",
    "optimize-css-assets-webpack-plugin": "5.0.1",
    "postcss-loader": "3.0.0",
    "prettier": "1.16.4",
    "reflect-metadata": "0.1.13",
    "rimraf": "2.6.3",
    "sass": "1.17.4",
    "sass-loader": "7.1.0",
    "simple-progress-webpack-plugin": "1.1.2",
    "style-loader": "0.23.1",
    "terser-webpack-plugin": "1.2.3",
    "thread-loader": "2.1.2",
    "to-string-loader": "1.1.5",
    "ts-loader": "5.3.3",
    "tslint": "5.15.0",
    "tslint-config-prettier": "1.18.0",
    "tslint-loader": "3.5.4",
    "typescript": "3.2.4",
    "webpack": "4.29.6",
    "webpack-cli": "3.3.0",
    "webpack-dev-server": "3.2.1",
    "webpack-merge": "4.2.1",
    "webpack-notifier": "1.7.0",
    "webpack-visualizer-plugin": "0.1.11",
    "workbox-webpack-plugin": "3.6.3",
    "write-file-webpack-plugin": "4.5.0",
    "xml2js": "0.4.19"
  },
  "engines": {
    "node": ">=8.9.0"
  },
  "lint-staged": {
    "{,src/**/}*.{md,json,ts,css,scss,yml}": [
      "prettier --write",
      "git add"
    ]
  },
  "scripts": {
    "prettier:format": "prettier --write \"{,src/**/}*.{md,json,ts,css,scss,yml}\"",
    "lint": "tslint --project tsconfig.json -e 'node_modules/**'",
    "lint:fix": "npm run lint -- --fix",
    "ngc": "ngc -p tsconfig-aot.json",
    "cleanup": "rimraf target/classes/static/ target/classes/aot",
    "clean-www": "rimraf target/classes/static/app/{src,target/}",
    "start": "npm run webpack:dev",
    "start-tls": "npm run webpack:dev -- --env.tls",
    "serve": "npm run start",
    "build": "npm run webpack:prod",
    "test": "npm run lint && jest --coverage --logHeapUsage -w=2 --config src/test/javascript/jest.conf.js",
    "test:watch": "npm run test -- --watch",
    "webpack:dev": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --env.stats=minimal",
    "webpack:dev-verbose": "npm run webpack-dev-server -- --config webpack/webpack.dev.js --inline --hot --port=9060 --watch-content-base --profile --progress --env.stats=normal",
    "webpack:build:main": "npm run webpack -- --config webpack/webpack.dev.js --env.stats=minimal",
    "webpack:build": "npm run cleanup && npm run webpack:build:main",
    "webpack:prod:main": "npm run webpack -- --config webpack/webpack.prod.js --profile",
    "webpack:prod": "npm run cleanup && npm run webpack:prod:main && npm run clean-www",
    "webpack:test": "npm run test",
    "webpack-dev-server": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js",
    "webpack": "node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js"
  },
  "jestSonar": {
    "reportPath": "target/test-results/jest",
    "reportFile": "TESTS-results-sonar.xml"
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
pascalgrimaud commented 5 years ago

Just reproduced and discovered a major issue here. The problem comes from your JDL which is incorrect. In fact, your entity can't end with Detail. See this code: https://github.com/jhipster/generator-jhipster/blob/master/generators/entity/index.js#L270

But the problem is major, as all error are not displayed any more. Just try: jhipster entity 999, and the result is:

INFO! Executing jhipster:entity 999
INFO! Options: from-cli: true
INFO! Congratulations, JHipster execution is complete!
pascalgrimaud commented 5 years ago

Using git bisect, I got this result:

18b42dda1888de796a0128cb43b12e05edd45d08 is the first bad commit
commit 18b42dda1888de796a0128cb43b12e05edd45d08
Author: Panayiotis Vlissidis
Date:   Thu Feb 14 18:27:55 2019 +0200

    Update yeoman dependencies

:100644 100644 11ff0c967ede1ce8938380d51ce0fb7b13771249 13e1595573a5576c2157f47111e170bb5955bfc0 M  package.json

It seems an issue with yeoman-environment. If I downgrade to from 2.3.4 to 2.3.0, it works

pascalgrimaud commented 5 years ago

This commit can probably help here: https://github.com/yeoman/environment/commit/78afb921b47ef0d2d985e4671189c68c1ca500af

Maybe we need to handle the error better in the generator to solve this. I'm putting a bug bounty, as I think it's an important issue.

cc @jhipster/developers

pascalgrimaud commented 5 years ago

I think I have the fix. I'll try to finish my dev today. Not sure, but maybe we need a patch release for that ?

MathieuAA commented 5 years ago

@pascalgrimaud Yep clearly this needs a release... nice catch

pascalgrimaud commented 5 years ago

Bounty claimed at https://opencollective.com/generator-jhipster/expenses/8123