1

我有一个简单的 JHipster JDL 文件,如下所示

entity Student {
  name String, 
  age Integer
}

我把它保存在一个名为 student.jh 的文件中

现在我正在尝试使用 JHipster CLI 并生成我的虚拟项目所需的实体。我注意到默认情况下 JHipster 最终会生成以下内容:

  • 实体类
  • DTO 类
  • 存储库类
  • 服务类(我认为我们可以通过添加是否还需要服务实现的选项来进一步自定义)
  • 休息控制器
  • 集成测试
  • 加特林测试(我相信这是可配置的)

我希望知道是否可以让 JHipster 跳过生成其余控制器,因为我想手动添加自定义休息控制器。我知道我可以只删除这些控制器(以及生成的集成测试)。

有什么办法可以控制这种情况吗?我已经尝试使用所有 cli 选项,jhipster import-jdl但还没有运气。

这是我正在使用的命令

jhipster import-jdl src/main/resources/student.jh

这是完整的输出

jhipster -d import-jdl src/main/resources/student.jh
INFO! Using JHipster version installed globally
DEBUG!  Executing CLI only script
DEBUG!  cmd: import-jdl from ./import-jdl
DEBUG!  args: [object Undefined]
INFO! Executing import-jdl src/main/resources/student.jh
DEBUG!  Options: debug: true, skip-install: false, interactive: false, json-only: false, ignore-application: false, ignore-deployments: false, skip-ui-grouping: false, skip-db-changelog: false, skip-sample-repository: false, skipInstall: false, jsonOnly: false, ignoreApplication: false, ignoreDeployments: false, skipUiGrouping: false, skipDbChangelog: false, skipSampleRepository: false, from-cli: true, fromCli: true, inline:
DEBUG!  JDLProcessor started with files: src/main/resources/student.jh and options: debug: true, skip-install: false, interactive: false, json-only: false, ignore-application: false, ignore-deployments: false, skip-ui-grouping: false, skip-db-changelog: false, skip-sample-repository: false, skipInstall: false, jsonOnly: false, ignoreApplication: false, ignoreDeployments: false, skipUiGrouping: false, skipDbChangelog: false, skipSampleRepository: false, from-cli: true, fromCli: true
INFO! Found .yo-rc.json on path. This is an existing app
INFO! The JDL is being parsed.
DEBUG!  importState exportedEntities: 1
DEBUG!  importState exportedApplications: 0
DEBUG!  importState exportedDeployments: 0
INFO! Found entities: Student.
INFO! The JDL has been successfully parsed
DEBUG!  Applications not generated
INFO! Generating 1 entity.
DEBUG! Generator is starting

Found the .jhipster/Student.json configuration file, entity can be automatically generated!


The entity Student is being updated.

DEBUG! Generator is starting
DEBUG! Time taken to write files: 62ms
   create src/main/resources/config/liquibase/changelog/20210202113651_added_entity_Student.xml
   create src/main/resources/config/liquibase/fake-data/student.csv
   create src/main/java/org/rationaleemotions/domain/Student.java
   create src/main/java/org/rationaleemotions/web/rest/StudentResource.java
   create src/main/java/org/rationaleemotions/repository/search/StudentSearchRepository.java
   create src/main/java/org/rationaleemotions/repository/StudentRepository.java
   create src/test/java/org/rationaleemotions/web/rest/StudentResourceIT.java
   create src/test/java/org/rationaleemotions/repository/search/StudentSearchRepositoryMockConfiguration.java
   create src/test/java/org/rationaleemotions/domain/StudentTest.java
    force src/main/resources/config/liquibase/master.xml
DEBUG! Generator has ended
DEBUG! Generator has ended
DEBUG!  Deployments not generated
INFO! Congratulations, JHipster execution is complete!

下面是我的 JHipster info 命令的完整输出

jhipster info
INFO! Using JHipster version installed globally
INFO! Executing jhipster:info
Welcome to the JHipster Information Sub-Generator

##### **JHipster Version(s)**

##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**


<details>
<summary>.yo-rc.json file</summary>
<pre>
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "org.rationaleemotions"
    },
    "jhipsterVersion": "6.10.5",
    "applicationType": "microservice",
    "baseName": "necropolis",
    "packageName": "org.rationaleemotions",
    "packageFolder": "org/rationaleemotions",
    "serverPort": "8081",
    "authenticationType": "oauth2",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "mariadb",
    "prodDatabaseType": "mariadb",
    "searchEngine": "elasticsearch",
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "embeddableLaunchScript": false,
    "creationTimestamp": 1611077969383,
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": false,
    "clientPackageManager": "npm",
    "blueprints": [],
    "skipClient": true,
    "skipUserManagement": true
  }
}

</pre>
</details>


##### **JDL for the Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**

<details>
<summary>JDL entity definitions</summary>

<pre>
entity Student {
  name String,
  age Integer
}
microservice Student with necropolis
clientRootFolder Student with necropolis

</pre>
</details>


##### **Environment and Tools**

openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

git version 2.30.0

node: v14.15.3

yeoman: 3.1.1

Docker version 20.10.0, build 7287ab3

docker-compose version 1.27.4, build 40524192

identical .jhipster/Student.json
INFO! Congratulations, JHipster execution is complete!
4

0 回答 0