SyntaxError: Error: unexpected character: -> <- at offset: 3703, skipped 1 characters.
Error while parsing applications and entities from the JDL SyntaxError: Error: unexpected character: -> <- at offset: 3703, skipped 1 characters.
SyntaxError: Error: unexpected character: -> <- at offset: 3703, skipped 1 characters.
at callApiMethod (/home/leinuo/coding/data-center/node_modules/generator-jhipster/node_modules/jhipster-core/lib/readers/jdl_reader.js:101:11)
at parse (/home/leinuo/coding/data-center/node_modules/generator-jhipster/node_modules/jhipster-core/lib/readers/jdl_reader.js:85:10)
at Object.parseFromFiles (/home/leinuo/coding/data-center/node_modules/generator-jhipster/node_modules/jhipster-core/lib/readers/jdl_reader.js:42:10)
at parseFiles (/home/leinuo/coding/data-center/node_modules/generator-jhipster/node_modules/jhipster-core/lib/jdl/jdl_importer.js:87:20)
at JDLImporter.import (/home/leinuo/coding/data-center/node_modules/generator-jhipster/node_modules/jhipster-core/lib/jdl/jdl_importer.js:69:92)
at JDLProcessor.importJDL (/home/leinuo/coding/data-center/node_modules/generator-jhipster/cli/import-jdl.js:80:41)
at JDLProcessor.importJDL (/home/leinuo/coding/data-center/node_modules/generator-jhipster/cli/import-jdl.js:294:38)
at module.exports (/home/leinuo/coding/data-center/node_modules/generator-jhipster/cli/import-jdl.js:461:21)
at Command.command.allowUnknownOption.description.action.args (/home/leinuo/coding/data-center/node_modules/generator-jhipster/cli/cli.js:72:36)
at Command.listener (/home/leinuo/coding/data-center/node_modules/commander/index.js:315:8)
提示是jdl文件格式错误,但是在jdl-studio编辑文件没有任何错误提示
只好对jdl文件中的实体逐一排查:
最终问题是:实体 } 后面的空格引发的血案,删除空格,再次导入,一切正常
温馨提示:
如果您在团队中工作,也许您希望拥有多个文件而不是一个文件。 我们添加了此选项,因此您不必手动将所有文件合并在一起, 而只需运行即可。
jhipster import-jdl my_file1.jdl my_file2.jdl
如果不想在导入JDL时重新生成实体,则可以使用--json-only
标志跳过实体创建部分,仅在.jhipster
文件夹中创建json文件。
jhipster import-jdl ./my-jdl-file.jdl --json-only
默认情况下,import-jdl
仅重新生成已更改的实体,如果要重新生成所有实体,则传递--force
标志。 请注意,这将覆盖您对实体文件的所有本地更改
jhipster import-jdl ./my-jdl-file.jdl --force
如果要在项目中使用它,可以通过执行以下操作来添加它:
- NPM:
npm install jhipster-core --save
- Yarn:
yarn add jhipster-core
将其安装在本地,并将其保存在package.json
文件中。