takuminのブログ

Java/PHP/JavaScript

jhipster導入

 

業務でJava(Springboot) + Angularでの開発にjoinしました。

Jhipsterで勉強していきます。

 

インストール

gインストールはしたくないので

$ cd project/git/
$ mkdir jhipster
$ cd jhipster
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (jhipster) 
version: (1.0.0) 
description: 
entry point: (index.js) 
test command: 
git repository: 
keywords: 
author: 
license: (ISC) 
About to write to /Users/takumi/project/git/jhipster/package.json:

{
  "name": "jhipster",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Is this ok? (yes) 

yoのインストール

$ npm i yo

> spawn-sync@1.0.15 postinstall /Users/takumi/project/git/jhipster/node_modules/spawn-sync
> node postinstall


> yo@2.0.0 postinstall /Users/takumi/project/git/jhipster/node_modules/yo
> yodoctor


Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version

Everything looks all right!
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN jhipster@1.0.0 No description
npm WARN jhipster@1.0.0 No repository field.

+ yo@2.0.0
added 385 packages in 11.991s

jhipsterのインストール

$ npm i generator-jhipster

> generator-jhipster@4.13.3 postinstall /Users/takumi/project/git/jhipster/node_modules/generator-jhipster
> opencollective postinstall


                   Thanks for installing generator-jhipster 🙏
                 Please consider donating to our open collective
                        to help us maintain this package.

                           Number of contributors: 366
                              Number of backers: 21
                              Annual budget: $10,923
                             Current balance: $1,019

     👉  Donate: https://opencollective.com/generator-jhipster/donate

npm WARN jhipster@1.0.0 No description
npm WARN jhipster@1.0.0 No repository field.

+ generator-jhipster@4.13.3
added 136 packages in 13.69s

yarnのインストール

$ npm i yarn

npm WARN deprecated yarn@1.3.2: It is recommended to install Yarn using the native installation method for your environment. See https://yarnpkg.com/en/docs/install
npm WARN jhipster@1.0.0 No description
npm WARN jhipster@1.0.0 No repository field.

+ yarn@1.3.2
added 1 package in 4.659s

プロジェクトの作成

jhipsterを使ってプロジェクトを作成していきます。

$ node_modules/.bin/yo jhipster

対話式でプロジェクトを作っていきます。

質問 選択項目 説明
May JHipster anonymously report usage statistics to improve the tool over time YES or NO レポート送る?
Which type of application would you like to create? Monolithic application Monolithic application モノリシックアプリ
Microservice application マイクロサービスアプリ
Microservice gateway マイクロサービスのゲートウェイ
JHipster UAA server (しらない)
What is the base name of your application? 記述 アプリケーション名
What is your default Java package name? 記述 javaパッケージ名
Do you want to use the JHipster Registry to configure, monitor and scale your application? YES or NO JHipsterレジストリ使いますか?
Which type of authentication would you like to use? JWT authentication ジョットで認証
OAuth 2.0 / OIDC Authentication OAuthで認証
HTTP Session Authentication セッションで認証
Which type of database would you like to use? SQL (H2, MySQL, MariaDB, PostgreSQL, Oracle, MSSQL) RDBでいく?
MongoDB モンゴでいく?
Cassandra カサンドラでいく?
[BETA] Couchbase (しらない)
Which production database would you like to use? MySQL どのRDBでいく?
MariaDB
PostgreSQL
Oracle
Microsoft SQL Server
Which development database would you like to use? H2 with disk-based persistence dev環境のDBはどうする?
H2 with in-memory persistence inmemoryDBでいく?
MySQL devもmysql
Do you want to use the Spring cache abstraction? Yes, with the Ehcache implementation (local cache, for a single node) どのキャッシュでいく?
Yes, with the Hazelcast implementation (distributed cache, for multiple nodes)
[BETA] Yes, with the Infinispan (hybrid cache, for multiple nodes)
No (when using an SQL database, this will also disable the Hibernate L2 cache)
Do you want to use Hibernate 2nd level cache? YES or NO L2キャッシュでいく?
Would you like to use Maven or Gradle for building the backend? Maven パッケージ管理はどっちでいく?
Gradle
Which other technologies would you like to use? (複数選択) Social login (Google, Facebook, Twitter) 他になんかいれる?
Search engine using Elasticsearch
WebSockets using Spring Websocket
API first development using swagger-codegen
Asynchronous messages using Apache Kafka
Which Framework would you like to use for the client? Angular 5 frontサイドのフレームワークは?
AngularJS 1.x
Would you like to enable SASS support using the LibSass stylesheet preprocessor? YES or NO SAAS使う?
Would you like to enable internationalization support? YES or NO 多言語いる?
Please choose the native language of the application 言語
Please choose additional languages to install 言語
Besides JUnit and Karma, which testing frameworks would you like to use? Gatling Junitとkarma以外でテストフレームワークいれる?
Cucumber
Protractor
Would you like to install other generators from the JHipster Marketplace? YES or NO marketから他のやついれる?

 

起動させてみる

$ ./gradlew

~~~略~~~
----------------------------------------------------------
        Application 'jhipster' is running! Access URLs:
        Local:          http://localhost:8080
        Profile(s):     [swagger, dev]
----------------------------------------------------------

http://localhost:8080/ にアクセスすると、、、

f:id:takumin03:20180120144633p:plain

次回は作成された中身をみていきます。