溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

關(guān)于jHipster框架在構(gòu)建中的出現(xiàn)的error修復(fù)

發(fā)布時間:2020-07-13 07:38:50 來源:網(wǎng)絡(luò) 閱讀:2793 作者:yerikyu 欄目:編程語言

jhipster The JDL object and the database type are both mandatory.這個錯誤應(yīng)該是在構(gòu)建基于jHipster的spring-cloud項(xiàng)目中經(jīng)常遇到的,因?yàn)檫@個在這個過程中會讀取.yo-rc文件,之后生成相關(guān)的.json文件,再之后生成相關(guān)的.java文件,層層依賴,一環(huán)扣一環(huán)。以下是出錯時的系統(tǒng)日志

yerlkyu@HP-Z440:/xxx/xxxx/jdls jhipster import-jdl pl.jdl
INFO! Using JHipster vers ion installed globall, INFO! Executing import-jdl pl.jdl
INFO! Options: from-cli: true INFO! The JDL is being parsed.
Error: The JDL object and the database type are both mandatory. ERROR!
Error while parsing applications and entities from the JDL Error: The JDL obiect and the database type are both mandatory.
Error: The JDL object and the database type are both mandatory. at object.parse (/usr/Lib/node modules/generator-ihipster/node modules/ihinstercore/lib/parser/entity parser. is:59:11)
at getJSONEntities (/usr/lib/node modules/ceneratorihipster/node modules/ihipster-core/1ib/idu/idl importer.is: 154:23
at importonlyEntities (/usr/lib/node modules/generator-ihipster/node modules/ihipstercore/ib/idl/idl importer.is: 102:24
at JDLImporter.import (/usr/lib/node modules/generator-ihipster/node modules/ihipster-core/lib/idl/id importer.is:67:43)
at JDLProcessor.importJDL (/usr/lib/node modules/qenenator-ihipster/cli/impont-id. is: 76:411
at JDLProcessor. importJDL (/usr/Lib/node modules/generator-ihipster/cli/import-idl.is : 292:38)
at module.exports {/usr/lib/node modules/generator-ihipster/cli/import-idl.is: 446:21)
at Command.command, allowUnknownOption.description.action. args (/usr/lih/node modules/cenerator-ihipster/cii/cli.is:72:36)
at Command.listener (/usr/lib/node modules/qeneratorihipster/node modules/commander/index, is:315:8)
at Command.emit (events.js:189:13)

修改完一份jdl文件,之后我們需要重新生成json文件,通過import-jdl這條指令讓其自動生成文件,然而一直觸發(fā)這個錯誤,大概意思是說找不到這.yo-rc文件,其依賴于.yo-rc.json這個文件的開發(fā),由于直接進(jìn)入jdl文件所在的文件夾不能搜索到根目錄中的.yo-rc.json文件,因此,在根目錄上執(zhí)行導(dǎo)入jdl文件即可,例如

1. jhipster import-jdl ./jdl/p1.jdl
2. jhipster import-jdl ./jdl/p1.jdl --force

注意這兩條命令的區(qū)別,作為前者,僅僅只會變更修改過的信息,不過由于這個框架在運(yùn)行的過程中有某些原因,有時候并不會自動生成變更文件,那么此時建議使用指令2,這個時候會強(qiáng)制覆蓋所有的文件,不過這個指令會帶來一個風(fēng)險(xiǎn),即會把原來的文件覆蓋,比如會生成類似HEAD等亂碼、或者覆蓋原來修改的文件。
其依賴json文件的生成生成,json文件如圖所示,
關(guān)于jHipster框架在構(gòu)建中的出現(xiàn)的error修復(fù)

生成的文件,比如mapper層,數(shù)據(jù)庫表結(jié)構(gòu),DTO、impl等接口的生成都是依賴于這個jdl的生成,這個框架的集成會自動覆蓋之前生成的文件,如果你已經(jīng)做了修改的話,建議通過查詢修改歷史 記錄,恢復(fù)原來修改的數(shù)據(jù),這個是這套框架的一個bug,開著團(tuán)隊(duì)聲明說他們已經(jīng)修復(fù)了這個錯誤,但看起來并不是很好的能夠修復(fù)他,因此,我們需要進(jìn)行手動修復(fù)。修復(fù)過程如圖所示
關(guān)于jHipster框架在構(gòu)建中的出現(xiàn)的error修復(fù)

至于說jHipster這個框架所生成的mapper文件則是通過運(yùn)行g(shù)radle 服務(wù),使其自動生成*mapper這個映射層文件。

參考資料
jhipster官方網(wǎng)站:https://www.jhipster.tech/

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI