JDEE
以下のサイトの手順通りにJDEEをインストールしました。
jde.elのコードに jde-get-tools-jar() という関数があるので、classes.jarのパスを以下のように修正すればOK。
なんでこんなことをする必要があるのか分からなかったんですけど、darwinでは $JAVA_HOME/lib/tools.jarっていうファイルはなくて、$JAVA_HOME/../Classes/classes.jarがその代わりになるのね。そんなん知らんわー!めっちゃ sudo find / -name tools.jarしちゃったじゃん!
tools.jar does'nt exist on Mac OSX.
http://developer.apple.com/documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.htmlI know maven already do this, probably the same "conversion" should be applied to system dependencies:
1. For Darwin, use classes.jar for TOOLS_JAR
TOOLS_JAR="${JAVA_HOME}/lib/tools.jar"
if $darwin; then
TOOLS_JAR="/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Classes/classes.jar"
fi
MACOSX版eclipseのJ2EEプラグイン"lomboz"の設定について教えてください。
"tools.jar"の設定をしようと、このファイルを探しているんですがどこにもありません。
どなかたご存知の方がいらっしゃいましたらご教授願います。
ちなみに環境は
MACOS 10.2.4(BSDTOOLインストール済)
DeveloperTool
Eclipse2.1 for Macosx+lomboz2.1
Mac OS Xではtools.jarという名前の物はありません。
同じ内容の物はclasses.jarとなります。
1.3.1であれば以下にあります。
/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Classes/classes.jar
ま、手順通りにやればOKなんですが、tools.jar関係の修正がちょっとだけ分かりにくかったので補足。
site-lisp内のjde-2.3.x.x/lisp/jde.elの以下の関数
(defun jde-get-tools-jar () "Gets the correct tools.jar or equivalent. Signals an error if it cannot find the jar." (let ((tools (expand-file-name (if (eq system-type 'darwin) "Classes/classes.jar" "lib/tools.jar") (jde-get-jdk-dir)))) (if (file-exists-p tools) tools (error (concat "Cannot find JDK's tools jar file (or equivalent)." "Type M-x describe-function [RET] jde-get-jdk-dir for more info.")))))
の"Classes/classes.jar"を"../Classes/classes.jar"に変更します。
で、Emacsを再起動すればオッケー。C-C C-v C-cでコンパイルが実行できます。
コンパイルできるようになったのはいいんだけど、必要なjarがクラスパスに設定されてないので、コンパイル失敗しちゃう。JDEEでmaven2のpom.xmlに書いてあるライブラリパスを通した上でコンパイルするのはどうしたらいいのかな?
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] ------------------------------------------------------------------------
JDK6
http://server.apnet.cz/~benzin/maven-emacs-plugin/dependencies.html をみてたらtools.jarが1.6になっていたのでJava6をインストールしてみた。http://developer.apple.com/java/ からダウンロードね。
$ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home $ mvn -version Maven version: 2.0.8 Java version: 1.6.0_04-dp OS name: "mac os x" version: "10.5.2" arch: "x86_64" Family: "mac"
と1.6が動いているのを確認して、再度mvn installを試してみたら結果はエラーメッセージが文字化けしただけで同じ結果。