まずは、Maven をインストールして、Eclipse から使えるようにする。その前に、Eclipse を 3.7 Indigo から 4.2 Juno にアップグレードした。
さて、Maven 用のプラグイン m2eclipse (m2e) を以下の URL からインストールする。
Eclipse を再起動すると、以下のワーニングが...
The Maven Integration requires that Eclipse be running in a JDK,
because a number of Maven core plugins are using jars from the JDK.
Please make sure the -vm option in eclipse.ini is pointing to a JDK and
verify that Installed JREs are also using JDK installs.
eclipse.ini の -vm オプションで JDK を指定せよとのこと。
-vm は -vmargs よりも前に指定すること、改行に注意すること。
これだけではまだ不足、Preference で Installed JREs の設定が必要である。JRE ではなく、JDK を指定すること。
次に Maven をインストールする。ZIP ファイルを解凍し、コマンドパスに bin ディレクトリを追加する。この時点での最新バージョンは 3.0.4 であった。
最後に、m2e から使う Maven を指定する。デフォルトでは Eclipse 組み込みの Maven を使うようになっている。Eclipse のメニュー Window - Preference - Maven - Installations から、インストールした Maven のパスを追加し、これを選択する。
さて、Maven の使い方をマスターしなければ。
リソース:
- m2eclipse - http://m2eclipse.sonatype.org/sites/m2e
- Eclipse - http://www.eclipse.org/
- Apache Maven - http://maven.apache.org/