如何在JHipster的 spring-controller generation 中定义基本名称?
我试图使用JHipster来生成弹簧控制器。它无法生成,将堆栈跟踪复制到下面。进一步调查显示这是崩溃因为basename未定义(module.exports.getAngularAppName需要basename才能有值)。
其他JHipster生成器(网关,微服务,整体,弹簧服务)工作正常,因此它不是一般配置问题。
我尝试将类似模式的JHipster生成器中的getTheModuleName()添加到spring-controller / prompts.js,但它不起作用,因为this.getModuleName()不存在。我无法找到定义getModuleName()的位置,也无法理解"这个"在提示之内。
我是一个JHipster noob所以我假设我错过了一些简单的东西。
任何帮助都将不胜感激。
C:\yesOnWindows>jhipster spring-controller fum
Using JHipster version installed globally
Executing jhipster:spring-controller fum
Options:
The spring-controller fum is being created.
? Do you want to add an action to your controller? Yes
? What is the name of your action? fff
? What is the HTTP method of your action? GET
? Do you want to add an action to your controller? No
events.js:183
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'endsWith' of undefined
at module.exports.getAngularAppName (C:\Users\Dad\nodejs\node_modules\generator-jhipster\generators\generator-base.js:2090:56)
at module.exports.getMainClassName (C:\Users\Dad\nodejs\node_modules\generator-jhipster\generators\generator-base.js:2113:40)
at module.exports.writing (C:\Users\Dad\nodejs\node_modules\generator-jhipster\generators\spring-controller\index.js:83:31)
at Object.<anonymous> (C:\Users\Dad\nodejs\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:399:25)
at C:\Users\Dad\nodejs\node_modules\generator-jhipster\node_modules\yeoman-generator\node_modules\run-async\index.js:25:25
at new Promise (<anonymous>)
at C:\Users\Dad\nodejs\node_modules\generator-jhipster\node_modules\yeoman-generator\node_modules\run-async\index.js:24:19
at self.env.runLoop.add.completed (C:\Users\Dad\nodejs\node_modules\generator-jhipster\node_modules\yeoman-generator\lib\index.js:400:11)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
答案 0 :(得分:1)
JHipster弹簧生成器旨在用于生成的JHipster项目。生成器从项目的baseName
文件(for example here)中读取.yo-rc.json
属性。在没有首先生成项目的情况下,JHipster无法生成可编译的Java文件。