Java教程

Jhipster入门

本文主要是介绍Jhipster入门,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

使用 Yarn 本地安装(推荐方式)

1.安装 Java 8,配置maven环境

2. 安装 Node.js(安装稳定版)

3. 安装 Yarn(包管理工具)

npm install -g yo

npm install -g generator-jhipster

npm install -g yarn

4. 如果你打算使用 JHipster Marketplace, 安装 Yeoman:

yarn global add yo

5. 安装 JHipster:

yarn global add generator-jhipster

问题:1.安装Yarn需要配置本地仓库 

yarn config set registry http://192.168.85.18:8081/repository/npm-group/            

一旦 JHipster 安装好了,下一步就可以开始:创建应用

1.在任意一个位置创建一个空的文件夹用来存放jhipster生成的项目代码

mkdir myapp2  // 创建文件夹

cd mypp2  // 进入文件夹

jhipster // 生成应用

2.开始生成会有以下提示

123.png

Monolithic application (recommended for simple projects) // 选择创建的应用种类,选第一个单体应用

What is the base name of your application? myapp2 // 应用名称

 What is your default Java package name? com.mycompany.myapp // 包名这里选了默认的

Do you want to use the JHipster Registry to configure, monitor and scale your application? Nojhipster registry是一个基于spring cloud的配置中心

 Which *type* of authentication would you like to use? JWT authentication (stateless, with a token)  // 选择验证方式

Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL)  //使用哪种数据库这里选了关系型数据库

 Which *production* database would you like to use? MySQL //生产数据库选择MySQL

Which *development* database would you like to use? H2 with disk-based persistence //开发数据库选择H2

Do you want to use the Spring cache abstraction? Yes, with the Ehcache implementation (local cache, for a single node) //本地缓存方案选择Ehcache

Do you want to use Hibernate 2nd level cache? Yes //是否使用Hibernate二级缓存,这里选yes

Would you like to use Maven or Gradle for building the backend? Maven //使用后台构建系统,这里选择Maven

 Which other technologies would you like to use? //可选技术,不选择直接回车

Which *Framework* would you like to use for the client? Angular 5 // 这里使用 Angular 5

Would you like to enable *SASS* support using the LibSass stylesheet preprocessor? No //这里选择No,装这个需要pyhthon2的环境

Would you like to enable internationalization support? Yes //是否支持国际化,选择是

Please choose the native language of the application Chinese (Simplified) // 本地语言选择中文简体

Please choose additional languages to install // 选择英语

Besides JUnit and Karma, which testing frameworks would you like to use? (Press <space> to select, <a> to toggle all, <i> to inverse selection) // 是否使用单元测试

3.一般情况直接下一步下一步就行(注意:询问是否安装sass时选择No,因为安装这个需要Python2的环境)

4.设置完毕后程序会创建基础文件和下载依赖的jar包

5.如果出现phantomjs-2.1.1-windows.zip这个文件下载失败,直接到\\192.168.5.223\soft\JHipster目录下把文件放到提示存放的位置

6.build成功后执行

mvn spring-boot:run //后台启动

yarn start  //前台启动

这篇关于Jhipster入门的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!