PlayでCRUDモジュールを使う
最近知ったPlayフレームワークがすごい。
JavaだけどRailsみたいな感覚で開発ができる。個人的にはMigrationがいらない分、Railsよりサクサク開発できる。OSに関係なく手間いらずで動くし、プロトタイプをサッと作るのにはもってこい。
そんなPlayでCRUDモジュールを使ってみた。
チュートリアルの説明では/conf/dependencies.ymlを編集してから/conf/routesを修正してcontrollerでCRUDを継承すれば動作すると書いてあるはずだったが、そのとおりに実行するとコンパイルエラーになってしまう。
Compilation error The file /app/controllers/Applicants.java could not be compiled. Error raised is : CRUD cannot be resolved to a type In /app/controllers/Applicants.java (around line 3) 1:package controllers; 2: 3:public class Applicants extends CRUD{ 4:}
なんだかおかしいので検索してみると以下の記事を発見した。
http://stackoverflow.com/questions/7325633/importing-crud-module-in-play-1-2-3
どやらコマンドを叩く必要があるらしい。
C:\app_path>play dependencies ~ _ _ ~ _ __ | | __ _ _ _| | ~ | '_ \| |/ _' | || |_| ~ | __/|_|\____|\__ (_) ~ |_| |__/ ~ ~ play! 1.2.3, http://www.playframework.org ~ ~ Resolving dependencies using C:\app_path\conf\dependencies.yml, ~ ~ ~ Installing resolved dependencies, ~ ~ modules/crud -> C:\Program Files\play\modules\crud
できた。あんまりドキュメントには力入れてないのかな?