m2eclipseのなぞ
不思議だ。Eclipse galilleo SR2を導入し、m2eclipseを入れた。ワークスペースが混乱していたので、作り直し、既存プロジェクトをチェックアウトしたらいくつかのプロジェクトでコンパイルエラーとなってしまった。コンパイルエラーの内容は以下。
Description Resource Path Location Type Could not calculate build plan: Missing: ---------- 1) org.apache.maven.plugins:maven-war-plugin:maven-plugin:2.1-alpha-1 Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-war-plugin -Dversion=2.1-alpha-1 -Dpackaging=maven-plugin -Dfile=/path/to/file Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-war-plugin -Dversion=2.1-alpha-1 -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id] ---------- 1 required artifact is missing. for artifact: org.apache.maven.plugins:maven-war-plugin:maven-plugin:2.1-alpha-1 from the specified remote repositories: central (http://repo1.maven.org/maven2, releases=true, snapshots=false) 201004XxxxXxxx Unknown Maven Problem
つまり、maven-war-pluginファイルがダウンロードできないと言うことのように思う。しかし、以下で確認したが公開されているようで、ブラウザからも確認できた。
http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-war-plugin/2.1-alpha-1
ダウンロードできない理由がさっぱりわからないので、pom.xmlのdependencyに手動で追加してみたら、ダウンロードでき、エラーも消えた。
はて。不思議なのでもう一度、pom.xmlのdependencyから消してみたら今度はエラーが出ない。まあ、ローカルリポジトリにあるからだろうと思うので、ローカルリポジトリから該当jarがあるディレクトリを削除してみた。( .m2/repository/org/apache/mavenplugins/maven-war-plugin 以下すべて削除)
そして、dependencyに追加していない状態でEclipse上でリビルドしたが、今度はエラーが出ない。
もう一度、dependencyに追加すると、先ほど削除したディレクトリがまた作成されていたので、間違いはなさそうである。
いったいどういうことなのか、まったくわからない。ただ、コンパイルエラーは消えたままだ。その後、ワークスペースを作り直しても見たがエラーは二度と出ない。maven-pluginの情報がどこかに残るのだろうか。....
もうここまできたので、ローカルリポジトリも思い切ってすべて削除してみた。結果は変わらず、コンパイルエラーも再現しなくなった。どういうことだろう。