在Windows平台安装jhipster。
- Windows 10;
- 安装JDK;
一、安装
安装方式1 使用NPM进行本地安装
- node v12.18.2;
- npm 6.14.5;
1.下载并安装nodejs,官网地址: nodejs官网。
可以参考这篇文章将镜像切换为国内:如何修改npm镜像源为国内镜像?
1.安装JHipster
npm install -g generator-jhipster
2.安装Yeoman
这一步可选,如果你需要使用模块和蓝图(例如从JHipster Marketplace获取),则执行这一步。
npm install -g yo
安装方式2 使用yarn本地安装
- yarn v1.22.4;
1.下载并安装yarn,官网地址: Yarn官网。
可以参考这篇文章将镜像切换为国内:如何修改yarn镜像源为国内镜像?
2.安装JHipster
yarn global add generator-jhipster
3.安装Yeoman
跟npm方式一样,这步可选。
yarn global add yo
二、安装应用
我是通过方式1安装的jhipster。
mkdir myapplication
cd myapplication/
jhipster
以下是我的构建选项:
? Which *type* of application would you like to create? Monolithic application (recommended for simple projects)
? [Beta] Do you want to make it reactive with Spring WebFlux? No
? What is the base name of your application? japp
? What is your default Java package name? com.aitlp.japp
? Do you want to use the JHipster Registry to configure, monitor and scale your application? Yes
? Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)
? Which *production* database would you like to use? Microsoft SQL Server
? Which *development* database would you like to use? Microsoft SQL Server
? Do you want to use the Spring cache abstraction? Yes, with the Ehcache implementation (local cache, for a single node)
? Do you want to use Hibernate 2nd level cache? Yes
? Would you like to use Maven or Gradle for building the backend? Gradle
? Which other technologies would you like to use?
? Which *Framework* would you like to use for the client? React
? Would you like to use a Bootswatch theme (https://bootswatch.com/)? Default JHipster
? Would you like to enable internationalization support? Yes
? Please choose the native language of the application English
? Please choose additional languages to install
? Besides JUnit and Jest, which testing frameworks would you like to use?
? Would you like to install other generators from the JHipster Marketplace? No
构建完成提示信息:
If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/
Server application generated successfully.
Run your Spring Boot application:
./gradlew (gradlew if using Windows Command Prompt)
Client application generated successfully.
Start your Webpack development server with:
npm start
因为我选的是SQL SERVER数据库,所以需要修改以下数据库配置,将config
下的application-dev.yml
文件中的数据库配置该为自己的地址:
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:sqlserver://localhost:1433;database=japp
username: SA
password: yourStrong(!)Password
然后运行Spring Boot应用:
PS E:\japp> .\gradlew
Downloading https://services.gradle.org/distributions/gradle-6.5-bin.zip
.................................................................................................
Welcome to Gradle 6.5!
Here are the highlights of this release:
- Experimental file-system watching
- Improved version ordering
- New samples
For more details see https://docs.gradle.org/6.5/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
参考: