2017-10-14 71 views
1

我創建JDL工作室文件沒有錯誤,但是當我輸入與jhipster CLI文件,我有以下錯誤:錯誤而解析JDL文件

 
Using JHipster version installed locally in current project's node_modules Executing jhipster:import-jdl ./thearthacker-jdl.jh 
Options: 
The jdl is being parsed. 
events.js:182 
     throw er; // Unhandled 'error' event 
    ^
Error: ERROR! 
Error while parsing entities from JDL 
    at Environment.error (E:\web_project\_PROJECT\thearthackers\node_modules\yeoman-environment\lib\environment.js:140:40) 
    at constructor.error (E:\web_project\_PROJECT\thearthackers\node_modules\generator-jhipster\generators\generator-base.js:1686:18) 
    at constructor.parseJDL (E:\web_project\_PROJECT\thearthackers\node_modules\generator-jhipster\generators\import-jdl\index.js:108:22) 
    at Object. (E:\web_project\_PROJECT\thearthackers\node_modules\yeoman-generator\lib\index.js:417:23) 
    at E:\web_project\_PROJECT\thearthackers\node_modules\run-async\index.js:25:25 
    at Promise() 
    at E:\web_project\_PROJECT\thearthackers\node_modules\run-async\index.js:24:19 
    at E:\web_project\_PROJECT\thearthackers\node_modules\yeoman-generator\lib\index.js:418:9 
    at runCallback (timers.js:781:20) 
    at tryOnImmediate (timers.js:743:5) 

,這是我JDL文件:

entity Video { 
    name String required, 
    type String required, 
    url String required, 
    quality String, 
    description String required, 
    submissionDate ZonedDateTime required 
} 
entity Picture { 
    name String required minlength(3), 
    type String required, 
    url String required, 
    size String, 
    description String, 
    submissionDate ZonedDateTime required 
} 

entity Blog { 
    name String required minlength(3), 
} 

entity Entry { 
    title String required, 
    content String required, 
    date ZonedDateTime required 
} 

entity Tag { 
    name String required minlength(2) 
} 


relationship ManyToMany { 
    Entry{tag(name)} to Tag{entry} 
} 

relationship ManyToMany { 
    Picture{tag(name)} to Tag{Picture} 
} 

relationship ManyToMany { 
    Video{tag(name)} to Tag{Video} 
} 

relationship ManyToMany { 
    Blog{tag(name)} to Tag{Blog} 
} 

relationship ManyToMany { 
    User{tag(name)} to Tag{User} 
} 

relationship ManyToOne { 
    Video{video} to User 
} 

relationship ManyToOne { 
    Picture{video} to User 
} 

relationship ManyToOne { 
    Blog{video} to User 
} 

relationship ManyToOne { 
    Entry{video} to Blog 
} 

paginate Entry, Tag with infinite-scroll 

dto * with mapstruct 

有什麼想法?

感謝您的幫助。

回答

3

我只是想你JDL並有此錯誤消息:

IllegalAssociationException: Relationships from User entity is not supported in the declaration between User and Tag. 

請注意,我使用的是當前開發分支,所以我有,你可能沒有(你不一條錯誤消息沒有給你的版本號,但是最近有所改進)。

這意味着您無法與用戶實體建立關係,因爲它不能由JDL修改 - 這是用戶實體特有的。你可以找到更多的信息on the relationships documentation

有幾種解決方案:您可以與用戶建立一對一的關係,並擁有通過JDL管理的另一個實體。或者您可以手動修改用戶實體(有些人將其分類並在子類上工作,以免更改用戶)。

+0

好吧,我刪除用戶的關係,它的工作原理。事實上,我沒有錯誤信息,所以很難調試。 –