我遇到了JHipster的问题。我无法在刚从头创建的项目中导入任何JDL文件。即使是来自JHipster的jdl样本也不起作用。我总是得到同样的错误:
events.js:182
throw er; // Unhandled 'error' event
^
Error: ERROR!
Error while parsing entities from JDL
at Environment.error (/project/node_modules/yeoman-environment/lib/environment.js:140:40)
at constructor.error (/project/node_modules/generator-jhipster/generators/generator-base.js:1686:18)
at constructor.parseJDL (/project/node_modules/generator-jhipster/generators/import-jdl/index.js:108:22)
at Object.<anonymous> (/project/node_modules/yeoman-generator/lib/index.js:417:23)
at /project/node_modules/run-async/index.js:25:25
at Promise (<anonymous>)
at /project/node_modules/run-async/index.js:24:19
at /project/node_modules/yeoman-generator/lib/index.js:418:9
at runCallback (timers.js:781:20)
at tryOnImmediate (timers.js:743:5)
使用--debug选项: 命令:
yo jhipster:import-jdl ~/Downloads/example.jh
输出:
The jdl is being parsed.
DEBUG! Error:
{ name: 'NoSQLModelingException',
message: 'NoSQL entities don\'t have relationships.',
prototype: Error
at new BuildException (/Users/jega/projects/owcHandwerker/plattformapp/node_modules/jhipster-core/lib/exceptions/exception_factory.js:42:25)
at checkNoSQLModeling (/Users/jega/projects/owcHandwerker/plattformapp/node_modules/jhipster-core/lib/parser/entity_parser.js:70:11)
at Object.parse [as convertToJHipsterJSON] (/Users/jega/projects/owcHandwerker/plattformapp/node_modules/jhipster-core/lib/parser/entity_parser.js:40:5)
at constructor.parseJDL (/Users/jega/projects/owcHandwerker/plattformapp/node_modules/generator-jhipster/generators/import-jdl/index.js:93:42)
at Object.<anonymous> (/Users/jega/projects/owcHandwerker/plattformapp/node_modules/yeoman-generator/lib/index.js:417:23)
at /Users/jega/projects/owcHandwerker/plattformapp/node_modules/run-async/index.js:25:25
at Promise (<anonymous>)
at /Users/jega/projects/owcHandwerker/plattformapp/node_modules/run-async/index.js:24:19
at /Users/jega/projects/owcHandwerker/plattformapp/node_modules/yeoman-generator/lib/index.js:418:9
at runCallback (timers.js:781:20) }
Error jhipster:import-jdl /Users/jega/Downloads/example.jh --debug
Error: ERROR!
Error while parsing entities from JDL
at Environment.error (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:157:40)
at constructor.error (/Users/jega/projects/owcHandwerker/plattformapp/node_modules/generator-jhipster/generators/generator-base.js:1686:18)
at constructor.parseJDL (/Users/jega/projects/owcHandwerker/plattformapp/node_modules/generator-jhipster/generators/import-jdl/index.js:108:22)
at Object.<anonymous> (/Users/jega/projects/owcHandwerker/plattformapp/node_modules/yeoman-generator/lib/index.js:417:23)
at /Users/jega/projects/owcHandwerker/plattformapp/node_modules/run-async/index.js:25:25
at Promise (<anonymous>)
at /Users/jega/projects/owcHandwerker/plattformapp/node_modules/run-async/index.js:24:19
at /Users/jega/projects/owcHandwerker/plattformapp/node_modules/yeoman-generator/lib/index.js:418:9
at runCallback (timers.js:781:20)
at tryOnImmediate (timers.js:743:5)
我尝试的JDL文件来自JHipster博客 - 示例在此处: https://github.com/jhipster/jdl-samples/blob/master/blog.jh
答案 0 :(得分:0)
您正在尝试生成在NoSQL项目中使用关系的实体。 JHipster对NoSQL项目不支持关系。有关JHipster如何处理关系的更多信息,请参阅Managing Relationships上的文档:
关系仅在使用JPA时有效。如果您选择使用Cassandra或MongoDB,它们将无法使用。
删除关系允许导入JDL。您还可以使用SQL数据库选项尝试使用项目。
JDL错误消息在JHipster的未来版本(v4.10.0 +)中更加冗长,因此您将来不会需要使用--debug
标志。