Yoemanジェネレータの一つ「Jhipster」でwebappの雛形を作成したのでメモしときます。
公式ドキュメントを参考にしました。かなり密度が濃く英語なので疲れますがその分、有益な情報が詰まっています。
前準備
- npmを最新版にアップデートします
1 |
npm install -g npm |
2. yoeman,bower,gulp-cli,をインストール。すでにインストールされてる場合はいりません。
1 2 3 |
npm install -g yo npm install -g bower npm install -g gulp-cli |
3. Jhipsterをインストール
1 |
npm install -g generator-jhipster |
JHipsterの起動
適当にディレクトリを作成し、以下のコマンドでyoemanを起動する。
1 |
yo |
その後に「jhispter」を選択する。
そうすると全部で16個質問されるが、雛形を作成する程度なら適当で問題ないと思う。
ついでに自分は以下の設定。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
(1/16) Which *type* of application would you like to create? Monolithic application ( recommended for simple projects) ? (2/16) What is the base name of your application? jhipster2 ? (3/16) What is your default Java package name? com.mycompany.myapp ? (4/16) Do you want to use the JHipster Registry to configure, monitor and scale your application? Yes ? (5/16) Which *type* of database would you like to use? SQL (H2, MySQL, MariaDB, Postg reSQL, Oracle, MSSQL) ? (6/16) Which *production* database would you like to use? MySQL ? (7/16) Which *development* database would you like to use? H2 with disk-based persist ence ? (8/16) Do you want to use Hibernate 2nd level cache? Yes, with ehcache (local cache, for a single node) ? (9/16) Would you like to use Maven or Gradle for building the backend? Maven ? (10/16) Which other technologies would you like to use? Social login (Google, Faceboo k, Twitter), Search engine using Elasticsearch, WebSockets using Spring Websocket, API first development using swagger-codegen, [BETA] Asynchronous messages using Apache Kafk a ? (11/16) Which *Framework* would you like to use for the client? AngularJS 1.x ? (12/16) Would you like to use the LibSass stylesheet preprocessor for your CSS? No ? (13/16) Would you like to enable internationalization support? Yes ? Please choose the native language of the application Japanese ? Please choose additional languages to install English ? (14/16) Besides JUnit and Karma, which testing frameworks would you like to use? Gatl ing, Cucumber, Protractor ? (15/16) Would you like to install other generators from the JHipster Marketplace? No Installing languages: ja, en |
ついでに選択肢については公式ドキュメントの下の部分を見ると良い。
インストールが終了すると以下の文字がターミナルに現れるはず
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Server application generated successfully. Run your Spring Boot application: ./mvnw Client application generated successfully. Inject your front end dependencies into your source code: gulp inject Generate the AngularJS constants: gulp ngconstant:dev Or do all of the above: gulp install Execution complete |
言われるがままgulp install を実行し、そのあとに
1 |
gulp serve |
でサーバー起動すると、勝手にブラウザが立ち上がり以下の画面に。
だがしかし…
雛形完成。試しにadminとuser でログインを試みるも
ログイン失敗と言われる。
デフォルトでadminとuserが用意されていると公式ドキュメントに書いてあるので、初期設定は関係ないはず。
Mavenというものを使ってサーバーを起動して見ることにした。「./mvnw spring-boot:run」で実行できるらしいが、JavaのJDKがないと動かないと言われたので大人しくこちらでインストール
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
ダウンロードファイルをダブルクリックすれば、勝手にインストーラーが起動するはず。
そして下記コマンド実行(かなり時間かかる)
1 |
./mvnw spring-boot:run |
下記画像(公式ドキュメント)にある通り、http://localhost:8080 に接続して見るも接続できない。そもそも『Maven』とは一体…
もう一度、gulp serveを実行し、ログインを試みるも結果はなにも変わらず…
何が原因なのかわからないので、解明に時間がかかりそうですがわかり次第、更新します。
スポンサードリンク