Jhipster 没有创建我在 jhipster 命令时导入的实体

问题描述 投票:0回答:2

我用过

jhipster import-jdl my_file.jdl
Jhipster版本V5.7.0

那个 jdl 文件的内容是(下面(IDK 应用程序?配置没有在堆栈溢出的代码编辑器中显示))

application {
    config {
        prodDatabaseType mysql
        buildTool maven
    }
}

entity Region {
    regionName String
}

entity Country {
    countryName String
}

// an ignored comment
/** not an ignored comment */
entity Location {
    streetAddress String,
    postalCode String,
    city String,
    stateProvince String
}

entity Department {
    departmentName String required
}

entity Task {
    title String,
    description String
}

entity Employee {
    firstName String,
    lastName String,
    email String,
    phoneNumber String,
    hireDate Instant,
    salary Long,
    commissionPct Long
}

entity Job {
    jobTitle String,
    minSalary Long,
    maxSalary Long
}

entity JobHistory {
    startDate Instant,
    endDate Instant,
    language Language
}

enum Language {
    FRENCH, ENGLISH, SPANISH
}

relationship OneToOne {
    Country{region} to Region
}

relationship OneToOne {
    Location{country} to Country
}

relationship OneToOne {
    Department{location} to Location
}

relationship ManyToMany {
    Job{task(title)} to Task{job}
}

relationship OneToMany {
    Employee{job} to Job,
    Department{employee} to Employee
}

relationship ManyToOne {
    Employee{manager} to Employee
}

relationship OneToOne {
    JobHistory{job} to Job,
    JobHistory{department} to Department,
    JobHistory{employee} to Employee
}

// Set pagination options
paginate JobHistory, Employee with infinite-scroll
paginate Job with pagination

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

// Set service options to all except few
//service all with serviceImpl except Employee, Job

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

和 cmd 显示

DEBUG!  importState exportedEntities: 0
DEBUG!  importState exportedApplications: 1  
DEBUG!  importState exportedDeployments: 0
INFO! No change in entity configurations, no entities were updated.

当我没有提到应用程序 > 配置详细信息时,它会给出错误信息

Error: The JDL object and the database type are both mandatory.        
ERROR! Error while parsing applications and entities from the JDL Error: The JDL object and the database type are both mandatory.

谁能告诉我我做错了什么?

java jhipster jdl
2个回答
3
投票

您需要将实体分配给应用程序,在应用程序配置中使用

entities *

application {
    config {
        prodDatabaseType mysql
        buildTool maven
    }
    entities *
}
// your entities here

0
投票

得到答案。

当我根据问题给出时,它仅根据 application>config 创建,如 mysql db、maven 构建工具,当我运行它时,它没有询问任何其他选项,如 basename、port、marketplace,而不是这 2 个字段( db,buildtool),它采用了所有默认值。

对于实体,它写了不覆盖实体/未找到额外实体

解决方案

1.首先只运行“jhipster”并选择选项

>jhipster

2.import jdl 没有 application>config properties

>jhipster import-jdl jdlfilename.jdl

jdlfilename 可以是 jdl 或 jh 格式,如果它在目录之外,请给出绝对路径

© www.soinside.com 2019 - 2024. All rights reserved.