Play framework 2.0 のアプリを Eclipse でデバッグする方法
Play framework 2.0 で作成した Web アプリを Eclipse 上でデバッグする方法をご紹介します。
準備
まず、play eclipsify を実行し、Eclipse 用のプロジェクトファイルを生成します。
デバッグ
まず、play debug run を実行し、デバッグモードで Play アプリケーションを起動しておきます。
デバッグモードで Play アプリケーションを起動
> play debug run Listening for transport dt_socket at address: 9999 [info] Loading project definition from ・・・\sampleApp\project [info] Set current project to sampleApp (in build file:/・・・/sampleApp/) --- (Running the application from SBT, auto-reloading is enabled) --- [info] play - Listening for HTTP on port 9000... (Server started, use Ctrl+D to stop and go back to the console...)
ここで出力された "Listening for transport dt_socket at address: 9999" の 9999 がデバッグ接続用のポート番号となりますので、Eclipse からこの 9999 へ接続してリモートデバッグします。
具体的には、Eclipse の Debug Configurations 画面を開き*2、「Remote Java Application」にデバッグ設定を追加します。
Project を選択し「Port」欄に 9999 を入力して「Debug」ボタンを押下すればリモートデバッグが開始されます。