Maven Emacs Plugin

The Emacs Plugin is used to generate prj.el files in source, and test-source directories which can automatic set some parameters for JDEE java project.

prj.elってのがJDEE上での1プロジェクトに該当するっぽいので、それを生成してくれるならいいかなーとか思ってインストールしようとしてみました。1.2.2のzipをダウンロードして解凍、そのディレクトリでmvn installを実行。大量のダウンロードの後、うまく行くかなーとか思ってたら、意外なところで失敗しました。

Missing:
----------
1) com.sun:tools:jar:1.5.0_13

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.5.0_13 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.5.0_13 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
  	1) org.apache.maven.plugin:maven-emacs-plugin:maven-plugin:1.2.2
  	2) com.sun:tools:jar:1.5.0_13

って出た。またtools.jarか!pom.xmlいじればいいのかな?
いやいや、エラーメッセージを読め俺。mvn install:install-fileすれば良さそうじゃん。

> mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.5.0_13 -Dpackaging=jar -Dfile=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar 
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Mojo Archetype
[INFO]    task-segment: [install:install-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [install:install-file]
[INFO] Installing /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar to /Users/akm/.m2/repository/com/sun/tools/1.5.0_13/tools-1.5.0_13.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Apr 16 11:49:20 JST 2008
[INFO] Final Memory: 3M/6M
[INFO] ------------------------------------------------------------------------

とりあえずclasses.jarをtools.jarとしてリポジトリにインストール。で、mvn install してみたら結果は同じ。っていうかmvn install:install-fileで入ってるはずなんだけど。なんでー?

答え

pom.xmlを見てみたら、ローカルのtools.jarを参照してました。

    <dependency>
      <groupId>com.sun</groupId>
      <artifactId>tools</artifactId>
      <version>${java.version}</version>
      <scope>system</scope>
      <systemPath>${java.home}/../lib/tools.jar</systemPath>
    </dependency>

やっぱり最初の直感が正しかった。ような気がするけど、結局またエラー。

$ mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Mojo Archetype
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [plugin:descriptor]
[INFO] Using 2 extractors.
[INFO] Applying extractor for language: java
[INFO] Extractor for language: java found 2 mojo descriptors.
[INFO] Applying extractor for language: bsh
[INFO] Extractor for language: bsh found 0 mojo descriptors.
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
Compiling 1 source file to /Users/akm/Downloads/maven-emacs-plugin-1.2.2/target/classes
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure

/Users/akm/Downloads/maven-emacs-plugin-1.2.2/src/main/java/org/apache/maven/plugin/jdee/JdeeMojo.java:[470,23] シンボルを見つけられません。
シンボル: 変数 Messages
場所    : org.apache.maven.plugin.jdee.JdeeMojo の クラス

/Users/akm/Downloads/maven-emacs-plugin-1.2.2/src/main/java/org/apache/maven/plugin/jdee/JdeeMojo.java:[498,24] シンボルを見つけられません。
シンボル: 変数 Messages
場所    : org.apache.maven.plugin.jdee.JdeeMojo の クラス

/Users/akm/Downloads/maven-emacs-plugin-1.2.2/src/main/java/org/apache/maven/plugin/jdee/JdeeMojo.java:[507,24] シンボルを見つけられません。
シンボル: 変数 Messages
場所    : org.apache.maven.plugin.jdee.JdeeMojo の クラス

/Users/akm/Downloads/maven-emacs-plugin-1.2.2/src/main/java/org/apache/maven/plugin/jdee/JdeeMojo.java:[1176,25] シンボルを見つけられません。
シンボル: 変数 Messages
場所    : org.apache.maven.plugin.jdee.JdeeMojo の クラス


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Wed Apr 16 14:02:38 JST 2008
[INFO] Final Memory: 9M/18M
[INFO] ------------------------------------------------------------------------