一、安装Jhipster前首先需要安装Java、Node。
Jhipster官网推荐安装Java的11版本,以及node的最新的LTS发行版本。
1.自行查看Java版本:
java -version
2.自行查看Node版本:
node -v
3.自行查看npm版本:
npm -v
(这里说明下,由于本人经常会用到不同版本的node,所以这边我用nvm管理安装多版本node,安装node时,会自动给对应的npm)。
二、开始安装Jhipster
1.安装之前可以先设置下npm的镜像加快下载速度(我用的是淘宝镜像,可自行选择其他镜像):
npm config set registry https://registry.npmmirror.com
查看镜像是否设置成功:
npm config get registry
2.安装Jhipster
npm install -g generator-jhipster
3.查看Jhipster是否安装成功:
jhipster --version
4.创建目录并打开:
mkdir myApp && cd myApp
5.启动 jhipster:
jhipster
启动成功页面如下:
6. 根据jhipster提示设置项目信息:
- 先放张所有问题和选的答案:
下面是具体问题的意思:
- 您的项目名是什么?
What is the base name of your application?
- 您想要创建什么类型的应用?(选项有单体架构和微服务架构等)
Which *type* of application would you like to create?
- 您的项目包名是什么?(这里会给个默认的包名,可自行修改)
What is your default Java package name?
- 您想通过maven还是gradle方式构建项目?
Would you like to use Maven or Gradle for building the backend?
- 您想创建一个spring webflux响应式项目吗?
Do you want to make it reactive with Spring WebFlux?
- 您想用哪种权限校验方式?
Which *type* of authentication would you like to use?
- 除了junit,您还想用哪种测试框架?(不需要其他测试框架直接回车)
Besides JUnit, which testing frameworks would you like to use?
- 您想用哪种类型数据库?
Which *type* of database would you like to use?
- 您的生产数据库具体想使用哪一种数据库?(即线上数据库类型)
Which *production* database would you like to use?
- 您的本地数据库具体想使用哪一种数据库?(即本地数据库类型)
Which *development* database would you like to use?
- 您想使用哪种缓存?(根据需要选择,不需要直接回车)
Which cache do you want to use?
-
您还想使用哪些其他技术?(根据需要选择即可)
Which other technologies would you like to use?
- 您想为前端选择哪个使用框架?
Which *framework* would you like to use for the client?
- 您是否需要生成管理界面?
Do you want to generate the admin UI?
- 您想使用哪种Bootswatch主题?(可打开bootswatch官网查看对应的主题)
Would you like to use a Bootswatch theme (https://bootswatch.com/)?
- 您想选择哪个Bootswatch导航栏主题?(这里我选择默认的Primary)
Choose a Bootswatch variant navbar theme (https://bootswatch.com/)?
- 您是否需要国际化支持?
Would you like to enable internationalization support?
- 请选择您应用的母语(我选的是中文简体)
Please choose the native language of the application
- 请选择您应用的其次语言(我选的是英语,通过上下箭头选择)
Please choose additional languages to install
接下来开始自动生成代码,只需静静等待。生成完毕截图:
如果是windows,通过mvnw启动后端项目:
mvnw